如果您只想要 ayes如果它是 1,并且每个其他值都会导致 a no,您可以这样做:
select case 
        when MyColumn = 'yes' then 1 
        else 0 
    end as MyDerivedValue
from MyTable
或者,您可以更具体:
select case MyColumn 
        when 'yes' then 1 
        when 'no' then 0
        when 'maybe' then 2
        else -1
    end as MyDerivedValue
from MyTable