SELECT col1, col2, IF( action = 2 AND state = 0, 1, 0 ) AS state from tbl1;
OR
SELECT col1, col2, (case when (action = 2 and state = 0) then 1 else 0 end) as state from tbl1;
both results will be the same ....
Khandad Niazi Jan 21 '14 at 13:38 2014-01-21 13:38
source share