Apr 5, 2002 #1 vorvad Technical User Nov 21, 2001 9 US I have one more question for the day. I am having problems finding help on 'if else' constructs. I want to do the following: select cola if cola > colb else colb from mytable Thanks in advance! VB
I have one more question for the day. I am having problems finding help on 'if else' constructs. I want to do the following: select cola if cola > colb else colb from mytable Thanks in advance! VB
Apr 5, 2002 #2 tlbroadbent MIS Mar 16, 2001 9,982 US If... Else... Is used for control of flow in T-SQL. You should use the CASE statment in queries. Select Col=Case When cola > colb Then cola Else colb End From mytable Terry L. Broadbent - DBA Computing Links: http://tlbroadbent.home.attbi.com/prog.htm faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions. Upvote 0 Downvote
If... Else... Is used for control of flow in T-SQL. You should use the CASE statment in queries. Select Col=Case When cola > colb Then cola Else colb End From mytable Terry L. Broadbent - DBA Computing Links: http://tlbroadbent.home.attbi.com/prog.htm faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
Apr 5, 2002 #3 bperry Programmer Jul 27, 2001 1,033 CA Here's one way: Select (CASE When Cola > Colb then Cola else Colb END) as TheColumn Upvote 0 Downvote