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.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 if statement inside sql query??

Author  Topic 

asksql
Starting Member

11 Posts

Posted - 2008-06-07 : 02:59:38
Hello,

I have an if statement for one of my columns in my query.
I want to write the if statement as a part of my select statement.
How would I do that. Do to a couple of rules I am not allowed to write a stored procedure for this.

I could use the "decode function" but

I have something like this:
if column1 = '1' or column2 = '2' then select "Yes" etc..

I tried doing select decode (column1 or column2, , , ) but it doesn't work.
Any ideas?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-07 : 03:21:10
Dupe http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104369



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -