我写的sql:
select emp_no,
sum((select * from(select
case when a.salary>b.salary
then 1 else 0 end
from salaries a
where a.emp_no = b.emp_no
and a.from_date > b.from_date
order by a.from_date asc)
where rownum=1))
from salaries b
group by b.emp_no;
在倒数第五行报 b.from_date 标识符无效,求问给位大神该怎么改啊
...全文
14116打赏收藏
orcle查询问题
统计各个员工涨幅的次数总和,表如下: 其中emp_no是员工编号,from_date是起始时间 我写的sql: select emp_no, sum((select * from(select case when a.salary>b.salary then 1 else 0 end from salaries a where a.emp_no = b.emp_no and a.from_date > b.from_date order by a.from_date asc) where row
-- 套一层是可以的。
select *,(select col from a where a.id = b.id) from b
-- 两层是不可以的
select *, (select (select col from a where a.id = b.id) from xxx where ) from b