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 |
|
NeilWhite
Starting Member
2 Posts |
Posted - 2009-05-21 : 11:16:17
|
| Hi There,I am trying to produce a query based on an existing query to selectively omit data from a membership list.My many query is :SELECT Name,Address,Telephone FROM Membersbut some members do not wish me to publisher their Telephone number, so I would like to produce another query to do that. I have added a boolean column in (called Permission) my table. In Visual Basic I would use the IIF command and would produce something like :SELECT Name,Address,IIF(Permission=1,Telephone,"") FROM Membersbut i don't know how to do this correctly in SQL. I would appriciate any help... |
|
|
mavershang
Posting Yak Master
111 Posts |
Posted - 2009-05-21 : 11:24:45
|
you could tryselect case when permission=1 then Telephone else '' endfrom membersquote: Originally posted by NeilWhite Hi There,I am trying to produce a query based on an existing query to selectively omit data from a membership list.My many query is :SELECT Name,Address,Telephone FROM Membersbut some members do not wish me to publisher their Telephone number, so I would like to produce another query to do that. I have added a boolean column in (called Permission) my table. In Visual Basic I would use the IIF command and would produce something like :SELECT Name,Address,IIF(Permission=1,Telephone,"") FROM Membersbut i don't know how to do this correctly in SQL. I would appriciate any help...
|
 |
|
|
NeilWhite
Starting Member
2 Posts |
Posted - 2009-05-21 : 11:34:26
|
| Thank you very much for the tip. With your help I have managed to achieve what I aimed to do. Thank you again. |
 |
|
|
|
|
|
|
|