日期:2014-05-18  浏览次数:20467 次

我是初学者,一个SQL的简单问题!
一个表table1(sex   bit)中的sex的值返回一张表(sex   char(2))当sex   为0时返回‘男’,为1时返回‘女’
 一个人在家,刚学习SQL不久,身边没有朋友学这些的,只好在这上面来了!谢谢的各位!

------解决方案--------------------
create table t(id int,sex bit)
insert t select 1,0
union all select 2,1
union all select 3,1
select 'ss '=
case sex
when 0 then '男 '
when 1 then '女 '
end
from t