一条SQL语句就行了select COL1*COL2 from (select (case when A = 'true' then 1 else 0 end) as COL1,(case when B < 2 then 1 else 0 end) as COL2 from C) as t
if c.a=true and c.b <2 then select 1;else select 0;