SQL 条件 判断 select case as

select case when string="1"
                   then "返回的数据1"
                   when string="2"
                   then "返回的数据2"
           else "返回的其他数据"
           end  as 新的列名
from table 
where ....

 

posted @ 2013-10-31 00:07  残星  阅读(2118)  评论(0编辑  收藏  举报