This seems like a simple question, but I haven't been able to find an answer. I am basically trying to do this:
SELECT * FROM table1
IF(columnA > 0) BEGIN
columnB = 'Greater than 0'
END
I don't want the value to change in the table, I just want it to change in the result. ANy suggestions?
SELECT ColumnA
, case when ColumnA > 0 then 'Greater than 0' else ColumnB END AS ColumnB
FROM table1;
This should work:
SELECT columnA, IIF(columnA > 0, 'Greater than 0', columnB)
FROM table1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With