SQL SERVER 语句: SELECT amount FROM tablename, 如果amount >100,则显示‘BIG’,否则显示自身数值;

[复制链接]
查看11 | 回复3 | 2013-1-9 11:27:33 | 显示全部楼层 |阅读模式
select case when amount>100 then 'BIG' else rtrim(ltrim(str(amount))) endas amount from tablename1楼的就是对的,不过字符和数值应当加个转换。...
回复

使用道具 举报

千问 | 2013-1-9 11:27:33 | 显示全部楼层
select case when amount>100 then 'BIG' else CONVERT(CHAR(4),amount) endasamount from tablename; 如楼上的,但需要加上类型转换。...
回复

使用道具 举报

千问 | 2013-1-9 11:27:33 | 显示全部楼层
select case when amount>100 then 'BIG' else amount end from tablename;...
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行