I have two columns, let's say col1
and col2
. both of them is float
It's always if col1 = 0 then col2 > 0
or col1 > 0 then col2 = 0
I want to select only one column which is greater than zero.
Thanks in advance
I have two columns, let's say col1
and col2
. both of them is float
It's always if col1 = 0 then col2 > 0
or col1 > 0 then col2 = 0
I want to select only one column which is greater than zero.
Thanks in advance
You can also use this :
SELECT CASE WHEN Col1 > 0 THEN COL1 ELSE Col2 END from your_table
You can use this for linq
from t in Table
select new { Col = ( t.col1 > 0 )?t.col1 : t.col2 }