sql语句

gaohenglove 2004-07-16 11:16:01
select rybh,rymc,csrq as sr from rydm where sr is not null

显示sr是无效的列名。我怎么能用别名作搜索条件呢?
...全文
92 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
futulove 2004-07-17
  • 打赏
  • 举报
回复
哦,没看到三楼以经回答过了,Sorry
futulove 2004-07-17
  • 打赏
  • 举报
回复
可以这样的
select * from (select rybh,rymc,csrq as sr from rydm) a where a.sr is not null
chentony 2004-07-17
  • 打赏
  • 举报
回复
對不能用別名作條件判斷哦
hudan 2004-07-16
  • 打赏
  • 举报
回复
select * from (select rybh,rymc,csrq as sr from rydm) b where b.sr is not null
gaohenglove 2004-07-16
  • 打赏
  • 举报
回复
select rybh,rymc,(......表达式....) as sr from rydm where ...

难道我要用如此长的表达式作搜索?
cgsun 2004-07-16
  • 打赏
  • 举报
回复
select rybh,rymc,csrq as sr from rydm where csrq is not null

34,873

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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