select billtype = case when buybill is not null and opt_type='0' then '0' when buybill is null and opt_type='0' then '1' when opt_type='1' then '2' end from 表
select billtype = case when buybill is not null and opt_type='0' then '0' when buybill is null and opt_type='0' then '1' whenopt_type='1' then '2' end from 表A
case when buybill is not null and opt_type='0' then billtype='0' else when buybill is null and opt_type='0' then billtype='1' else billtype='2' end
case
when buybill is not null and opt_type='0' then '0'
when buybill is null and opt_type='0' then '1'
when opt_type='1' then '2'
end
from 表
when buybill is not null and opt_type='0' then '0'
when buybill is null and opt_type='0' then '1'
whenopt_type='1' then '2'
end
from 表A
else when buybill is null and opt_type='0' then billtype='1'
else billtype='2' end