一个sql语句报错ORA-00904: "入职天数": 标识符无效 不清楚为什么
selectename,sal,trunc(sysdate-hiredate)as"入职天数"fromscott.empwhere"入职天数">=10000andsal<...
select ename,sal,trunc(sysdate-hiredate) as "入职天数" from scott.emp where "入职天数">=10000 and sal<=1200 order by sal,"入职天数"; 这个语句报错
第 1 行出现错误:
ORA-00904: "入职天数": 标识符无效
为什么? 展开
第 1 行出现错误:
ORA-00904: "入职天数": 标识符无效
为什么? 展开
展开全部
where 语句后面,"入职天数"是一个别名,不能用在这里。
select * from
( select ename,sal,trunc(sysdate-hiredate) as "入职天数" from scott.emp where sal<=1200 ) a where "入职天数">=10000 order by sal,"入职天数";
select * from
( select ename,sal,trunc(sysdate-hiredate) as "入职天数" from scott.emp where sal<=1200 ) a where "入职天数">=10000 order by sal,"入职天数";
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
"入职天数"改成trunc(sysdate-hiredate)
select ename,sal,trunc(sysdate-hiredate) as "入职天数" from scott.emp
where trunc(sysdate-hiredate)>=10000 and sal<=1200 order by sal,"入职天数";
select ename,sal,trunc(sysdate-hiredate) as "入职天数" from scott.emp
where trunc(sysdate-hiredate)>=10000 and sal<=1200 order by sal,"入职天数";
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询