How would I achieve the following:
select (1 < 2) as One, (1 > 2) as Two
so that it would yield the following results:
One Two
-----------------
True False
I'm using SQL Server but a cross DBMS example would be good.
Assuming this is SQL server, you can use CASE statement.
select (case when (1 < 2) then 'True' else 'False' end) as one,
(case when (1 > 2) then 'True' else 'False' end) as two
from table
In the place of condition, you can use any variable or any column values too. Basically an expression.
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