Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
desikankannan
Posting Yak Master
152 Posts |
Posted - 2008-02-18 : 08:12:35
|
Hi,iam working in a asp.net project, i have two table tblcouptypm,tblpoltymin firt table the structure isFIRST TABLE NAME - tblcouptypmfldccode,fldmeaning,flddesc,fldactiveG--------GARGAGE-----GARGEDES-----yP--------DFD---------RIT----------NS--------SUPPLIER----SUPPLIERDES--NU--------UNIT--------UNITDESC-----YSECOND TABLE NAME - tblpoltymfildtcode,fldpolname,fldccode,fldactivateTY0002----THEGRAY-------P----------NTY0002----THEGRAY-------S----------NTY0002----THEGRAY-------U----------NI NEED THE BELOW OUTPUT URGENTLY PLEASE GUIDE ME PLEASE VERY URGENT I WANTS TO GET OUTPUT BELOW I MEANTIONED FILDTCODE,FLDPOLNAME,FLDMEANING,FLDCCODE,FLDACTIVATE TY0002----THEGRAY-----DFD-------P---------N TY0002----THEGRAY-----SUPPLIER--S---------N TY0002----THEGRAY-----UNIT------U---------N TY0002----THEGRAY-----GARGAGE---G---------N Regardskannan.dDesikankannan |
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-02-18 : 08:20:43
|
select a.FILDTCODE a.FLDPOLNAME b.FLDMEANING a.FLDCCODE a.FLDACTIVATEfrom tblcouptypm a left join tblpoltym b on a.fldccode = b.fldccode "God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-02-18 : 08:50:31
|
quote: Hi,iam working in a asp.net project, i have two table tblcouptypm,tblpoltymin firt table the structure isFIRST TABLE NAME - tblcouptypmfldccode,fldmeaning,flddesc,fldactiveG--------GARGAGE-----GARGEDES-----yP--------DFD---------RIT----------NS--------SUPPLIER----SUPPLIERDES--NU--------UNIT--------UNITDESC-----YSECOND TABLE NAME - tblpoltymfildtcode,fldpolname,fldccode,fldactivateTY0002----THEGRAY-------P----------NTY0002----THEGRAY-------S----------NTY0002----THEGRAY-------U----------NI NEED THE BELOW OUTPUT URGENTLY PLEASE GUIDE ME PLEASE VERY URGENT I WANTS TO GET OUTPUT BELOW I MEANTIONED FILDTCODE,FLDPOLNAME,FLDMEANING,FLDCCODE,FLDACTIVATETY0002----THEGRAY-----DFD-------P---------NTY0002----THEGRAY-----SUPPLIER--S---------NTY0002----THEGRAY-----UNIT------U---------NTY0002----THEGRAY-----GARGAGE---G---------N
i don't understand your sample data. this last row (in red) it doesn't join to the other table and you've just decided to give it the same values? i.e. thegray, TY0002, N ...what's your logic here?Em |
 |
|
desikankannan
Posting Yak Master
152 Posts |
Posted - 2008-02-18 : 08:55:48
|
Hi,thanks for your reply select b.FILDTCODE, b.FLDPOLNAME, a.FLDMEANING, a.FLDCCODE ,b.FLDACTIVATEfrom tblcouptypm a left join tblpoltypm b on a.fldccode = b.fldccodewhat i want is that instead of null i wants below valuenull should be replace as TY0002, THEGRAY,NNULL----NULL----Gargage----G----NULLTY0002--THEGRAY--DFD-------P----NTY0002--THEGRAY--Suppliers-S----NTY0002--THEGRAY--UNIT------U----Nquote: Originally posted by jhocutt select a.FILDTCODE a.FLDPOLNAME b.FLDMEANING a.FLDCCODE a.FLDACTIVATEfrom tblcouptypm a left join tblpoltym b on a.fldccode = b.fldccode "God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking
Desikankannan |
 |
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2008-02-18 : 09:00:32
|
Then add TY0002----THEGRAY-------G----------N to tblpoltym"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
desikankannan
Posting Yak Master
152 Posts |
Posted - 2008-02-18 : 09:06:15
|
Hi,need like thisNULL----NULL----Gargage----G----NULL--THIS SHOULD BE REPLACEDAS TY0002----THEGRADY----Gargage----G----Nquote: Originally posted by jhocutt Then add TY0002----THEGRAY-------G----------N to tblpoltym"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking
Desikankannan |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-18 : 09:36:08
|
select coalesce(b.FILDTCODE,'AS TY0002') as FILDTCODE, coalesce(b.FLDPOLNAME,THEGRADY) as FLDPOLNAME,a.FLDMEANING, a.FLDCCODE ,coalesce(b.FLDACTIVATE,'N') as FLDACTIVATEfrom tblcouptypm a left join tblpoltypm b on a.fldccode = b.fldccodeMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|