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 |
|
zhshqzyc
Posting Yak Master
240 Posts |
Posted - 2008-08-07 : 13:59:12
|
Hello,I want to return "Y" or "N" according to the query result.where exist(select a from tablename where id='xxx') If it is true, return "Y". Otherwise "N".Can you please give me a hint?Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-07 : 14:03:49
|
| [code]select case when t1.a is null then 'N' else 'Y' endfrom yourtable tleft join tablename t1on t1.id=t.idwhere t.id='xxx'[/code] |
 |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2008-08-07 : 14:04:00
|
| [code]selectcoalesce((select distinct 'Y'from tablename where id='xxx'),'N') as Returned[/code] |
 |
|
|
|
|
|