IF Else Statement in SQL Statment
-
SELECT column1, column2, if (column3 = 0) begin 'Z', end else begin 'C', end FROM table1 Is it possible that i can do it this way?
KaKaShi HaTaKe
-
SELECT column1, column2, if (column3 = 0) begin 'Z', end else begin 'C', end FROM table1 Is it possible that i can do it this way?
KaKaShi HaTaKe
-
SELECT column1, column2, if (column3 = 0) begin 'Z', end else begin 'C', end FROM table1 Is it possible that i can do it this way?
KaKaShi HaTaKe
explain your:confused:self!!!!
nelsonpaixao@yahoo.com.br trying to help & get help
-
Now, a question for YOU. Which takes longer, typing it in to CP and waiting for a reply, or typing in into query analyser and running it? A clue, try the CASE statement.
Bob Ashfield Consultants Ltd
Ashfield wrote:
A clue, try the CASE statement.
A fine clue, that is :)
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
SELECT column1, column2, if (column3 = 0) begin 'Z', end else begin 'C', end FROM table1 Is it possible that i can do it this way?
KaKaShi HaTaKe
SELECT column1, column2, CASE WHEN (column3 = 0) THEN 'Z' ELSE 'C' END FROM table1 ------------- Mostafa Noor Egypt
-
SELECT column1, column2, if (column3 = 0) begin 'Z', end else begin 'C', end FROM table1 Is it possible that i can do it this way?
KaKaShi HaTaKe
Hi there, I think you might want to use a CASE statement. Not sure which database system you are using but it would look something like this... SELECT column1, column2, CASE column3 WHEN 0 THEN 'Z' ELSE 'C' END FROM table1 Cheers, Kevin