Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
列出与 MILLER 相同或大于 ALLEN 的emps 。jobjobsalsal
emp
job
sal
以上问题是oracle sql的常见问题。使用子查询的答案已经解决。但是只使用 join 来解决这个问题会是什么?
select * from emp where job = (select job from emp where ename = 'MILLER' ) or sal>(select sal from emp where ename = 'ALLEN');
Select * from emp e1 join emp e2 where (e2.Ename = 'Miller' and e1.job = e2.job) or (e2.Ename = 'Allen' and e1.sal > e2.sal)