我有这种情况:
我大致需要这样的东西:
foreach(var name in tableNames)
SELECT Name FROM EMPLOYEES WHERE Salary<( SELECT Salary FROM EMPLOYEES WHERE Name=name );
如何使用SQL实现该目标?
答案 0 :(得分:3)
使用自我加入:
select ee.name name1, e.name name2
from employees e
inner join employees ee on e.salary > ee.salary
order by e.name