this is easier to explain with an example...
I have a column in my table that contains either -1 or 0 and I want to retrieve it as either 'yes' for -1 or '' for 0. Is there any way to do this in an sql statement?
Printable View
this is easier to explain with an example...
I have a column in my table that contains either -1 or 0 and I want to retrieve it as either 'yes' for -1 or '' for 0. Is there any way to do this in an sql statement?
Use the CASE statement.
SELECT NewValue =
CASE Actualvalue
WHEN -1 THEN 'Yes' WHEN 0 THEN 'No'
ELSE 'Other'
END
from tablename