日期:2014-05-17 浏览次数:20727 次
create table Test123
(
id int,
isKehu varchar(2),
isYunying varchar(2)
)
insert into Test123 values (1,'是',null)
insert into Test123 values (2,'是',null)
insert into Test123 values (3,'是',null)
insert into Test123 values (4,null,'是')
insert into Test123 values (5,null,null)
select id ,
case
when (iskehu is not null) then '客户'
when (isYunying is not null) then '运营商'
else '内部员工' end as userType
from Test123
1 客户
2 客户
3 客户
4 运营商
5 内部员工