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 |
|
nssjari
Starting Member
46 Posts |
Posted - 2005-07-06 : 07:25:11
|
Hi friends ...---My existing query is as follows---selectcsd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi, csd1.csd_issu, csd1.csd_altr,tra1.tra_trno,csd2.csd_orig + csd2.csd_subj + csd2.csd_type + csd2.csd_numb + csd2.csd_revi, csd2.csd_issu, csd2.csd_altr,trd1.trd_trno, trd1.trd_recd,apr1.apr_docu, apr1.apr_reqd, apr1.apr_stat,tra2.tra_trno,csd3.csd_orig + csd3.csd_subj + csd3.csd_type + csd3.csd_numb + csd3.csd_revi, csd3.csd_issu, csd3.csd_altr,trd2.trd_trno, trd2.trd_recdfrom e0437csd csd1, e0437tra tra1, e0437csd csd2, e0437trd trd1, e0437apr apr1, e0437tra tra2, e0437csd csd3, e0437trd trd2wherecsd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi like '%SUBJECTCODE%' andcsd1.csd_ownr = 'BESIX' andcsd1.csd_aclas = 'CLASSCODE / TYPECODE' andtra1.tra_drgn = csd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi andtra1.tra_copy = 1 andtra1.tra_appr = True andtra1.tra_part = 'PARSO' andtra1.tra_type = 'A' andcsd2.csd_orig + csd2.csd_subj + csd2.csd_type + csd2.csd_numb + csd2.csd_revi = tra1.tra_trno andcsd2.csd_ownr = 'BESIX' andcsd2.csd_aclas = 'T' andtrd1.trd_trno = csd2.csd_orig + csd2.csd_subj + csd2.csd_type + csd2.csd_numb + csd2.csd_revi andtrd1.trd_part = 'PARSO' andtrd1.trd_type = 'A' andtrd1.trd_cc = '0' andapr1.apr_docu = csd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi andapr1.apr_part = 'PARSO' andapr1.apr_type = 'A' andtra2.tra_drgn = csd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi andtra2.tra_copy = 1 andtra2.tra_appr = False andtra2.tra_part = 'BESIX' andtra2.tra_type = 'I' andcsd3.csd_orig + csd3.csd_subj + csd3.csd_type + csd3.csd_numb + csd3.csd_revi = tra2.tra_trno andcsd3.csd_ownr = 'PARSO' andcsd3.csd_aclas = 'T' andtrd2.trd_trno = csd3.csd_orig + csd3.csd_subj + csd3.csd_type + csd3.csd_numb + csd3.csd_revi andtrd2.trd_part = 'BESIX' andtrd2.trd_type = 'I' andtrd2.trd_cc = '0' order bycsd1.csd_orig + csd1.csd_subj + csd1.csd_type + csd1.csd_numb + csd1.csd_revi---Now what i want is as follows---if "apr1.apr_stat" is null it must not select the rest of it in the select statement and hence no condition check in the where clause after tra2.blablabla onwards ... else if "apr1.apr_stat" is not null it must execute the whole query ...as it is as of now ... since this "apr1.apr_stat" checks for incase a document is replied or not ... if replied it has give me related details and if not it has to select the availble details atleast of those documents ...---I know its difficult to get it that easily ...But if u want to have more clrification please do reply to it ...asapIts urgent please ... Thanks for Co-op ... JariComputer Engg |
|
|
nssjari
Starting Member
46 Posts |
Posted - 2005-07-06 : 07:44:54
|
| Is this query going to output you only 1 record?Irfan.JariComputer Engg |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-06 : 07:48:22
|
| Not sure what you are asking forCan you provide some sample data with expected result?MadhivananFailing to plan is Planning to fail |
 |
|
|
nssjari
Starting Member
46 Posts |
Posted - 2005-07-06 : 07:50:23
|
| No it results all the records that are replied ... so far ...But does not give me records that are not replied ...JariComputer Engg |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2005-07-06 : 09:40:02
|
kill me. i cant read that. i think it is time to switch from decaf to Heroin. *need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected) |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-07-06 : 10:26:06
|
quote: Originally posted by DonAtWork kill me. i cant read that. i think it is time to switch from decaf to Heroin. *need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected)
ROFLMAO!!!I think you misunderstand the symbol (though probably more accurate here )Plus, caffiene is bad enough. Corey Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now." |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2005-07-07 : 07:44:45
|
i do know what the *Snipe* is for.But it just sort of SELECT SUM(feelings) FROM this_post for me.*need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected) |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2005-07-07 : 08:40:34
|
| Thread creator is having conversation with himself! |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-07-07 : 08:51:13
|
quote: Originally posted by DonAtWork i do know what the *Snipe* is for.But it just sort of SELECT SUM(feelings) FROM this_post for me.*need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected)
yeah... I was pretty sure you had the hang of it, but we can't have people volutarily *sniping* themselves We'll loose all of the good comments I gave up on this guy... he never actually tries to help himself.Corey Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now." |
 |
|
|
|
|
|
|
|