2012-04-17 23 views

答えて

3

あなたはそれが1である、とno内の他のすべての値の結果ならば、あなたはこれを行うことができますyesをしたい場合:

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 
+0

をMyDerivedValueとは何ですか? – antonpug

+0

@antonpug - その列のエイリアス名 – Lamak

関連する問題