select * from emp e1, (select deptno, avg(sal) avg_sal from emp group by deptno) e2 where e1.deptno=e2.deptno and e1.sal>e2.avg_sal; 原来是这个,怎么改inner join?
select * from emp e1 inner join (select deptno, avg(sal) avg_sal from emp group by deptno) e2 on e1.deptno=e2.deptno and e1.sal>e2.avg_sal; 是要求必须使用内连接吗,因为你已经实现了
select * from emp e1,
(select deptno, avg(sal) avg_sal from emp group by deptno) e2
where e1.deptno=e2.deptno and e1.sal>e2.avg_sal;
原来是这个,怎么改inner join?
(select deptno, avg(sal) avg_sal from emp group by deptno) e2 on
e1.deptno=e2.deptno and e1.sal>e2.avg_sal;
是要求必须使用内连接吗,因为你已经实现了
你的SQL原型本身就不是内连接,你当然无法转换成内连接了。如果一定要用join形式来实现,那么应当使用cross join.select * from emp e1 cross join (select * from emp) e2
select * from emp e1 inner join emp e2
on e1.字段=e2.字段
tx2730好像是正确,不过没在Oracle中验证。