SQL的case~~怎么出错啦?懂的来帮我看看~!

[复制链接]
查看11 | 回复2 | 2010-11-22 11:49:48 | 显示全部楼层 |阅读模式
select * from UserCate
/UserCate是表名

case CateName
/CateName是列名

when '本科生' then 111111;

when '教师' then 222222;

else

End
提示说case附近有语法错误~!哪里错了呢??怎么改?111122222那个是我乱写的、表理会它~!

回复

使用道具 举报

千问 | 2010-11-22 11:49:48 | 显示全部楼层
sql里select后一般不是case吧。select * from 。。建立一个数据集。然后后边一般是where 。然后order by什么什么
回复

使用道具 举报

千问 | 2010-11-22 11:49:48 | 显示全部楼层
select *,
(case CateName
--/CateName是列名
when '本科生' then 111111
when '教师' then 222222
else
33333
End )from UserCate
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行