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 |
|
dineshrajan_it
Posting Yak Master
217 Posts |
Posted - 2010-05-28 : 06:14:40
|
| hi,i have a table that contains three phone columns, i need to find out rows which doesnot have a phoneno in any of these three columns.create table phone( name varchar(100), phone1 varchar(10), phone2 varchar(10))insert into phone (name,phone1,phone2)values('ramesh','1234',null),('suresh',null,null) select *from phonewhere 0 = CASE WHEN phone1 IS NULL THEN CASE WHEN phone2 IS NULL THEN 0 ELSE 1 END ELSE 1 ENDit works. any other better solution. ThanksIam a slow walker but i never walk back |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2010-05-28 : 06:23:56
|
| select * from phone where phone1 is null and phone2 is null |
 |
|
|
dineshrajan_it
Posting Yak Master
217 Posts |
Posted - 2010-05-28 : 06:30:32
|
| I dont know how i missed this method. ThanksIam a slow walker but i never walk back |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2010-05-28 : 06:54:31
|
quote: Originally posted by dineshrajan_it I dont know how i missed this method. ThanksIam a slow walker but i never walk back
welcome |
 |
|
|
|
|
|