SQL查询问题

IT回忆录 2011-09-01 02:21:59
例如:查询tk_beg表全部数据

代码如下:
select
if sl>3000
select '超标'
else
select '合适'
from tk_beg

提示:if语法错误,但SQL2000支持这种语法

...全文
45 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangzhen_927116 2011-09-01
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fredrickhu 的回复:]
SQL code
select case when s1>3000 then '超标 else '合适' end from tk_beg
[/Quote]+1
q465897859 2011-09-01
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 ssp2009 的回复:]
SQL code
select (case when sl>3000 then '超标' else select '合适' end) from tk_beg
[/Quote]+1
geniuswjt 2011-09-01
  • 打赏
  • 举报
回复

select (case when sl>3000 then '超标' else '合适' end) from tk_beg
快溜 2011-09-01
  • 打赏
  • 举报
回复
select (case when sl>3000 then '超标' else '合适' end) from tk_beg
--小F-- 2011-09-01
  • 打赏
  • 举报
回复

--掉了 '
select case when s1>3000 then '超标' else '合适' end from tk_beg
快溜 2011-09-01
  • 打赏
  • 举报
回复
select (case when sl>3000 then '超标' else select '合适' end) from tk_beg
chuanzhang5687 2011-09-01
  • 打赏
  • 举报
回复
+1[Quote=引用 1 楼 fredrickhu 的回复:]
SQL code

select case when s1>3000 then '超标 else '合适' end from tk_beg
[/Quote]
--小F-- 2011-09-01
  • 打赏
  • 举报
回复
你的代码到2000里面也不行
--小F-- 2011-09-01
  • 打赏
  • 举报
回复
select case when s1>3000 then '超标 else '合适' end from tk_beg

22,207

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧