Hello,
I am querying a database and I have 2 bit columns I need to combine (for this example if one is true the column must be true).
Something like: Select col1 || col2 from myTable
What is the easiest way of achieving this?
Hello,
I am querying a database and I have 2 bit columns I need to combine (for this example if one is true the column must be true).
Something like: Select col1 || col2 from myTable
What is the easiest way of achieving this?
I'm assuming col1 and col2 are bit values, the closest Sql Server has to booleans.
To return 1 or 0:
select case when col1=1 or col2=1 then 1 else 0 end
from yourtable
To return true or false:
select case when col1=1 or col2=1 then 'true' else 'false' end
from yourtable