开窗分组,找出最大的年限,然后找出工作年限等于最大年限的
select tmp
.project_id
, tmp
.employee_id
from
(
select *, max(t
.experience_years
) over(partition by t
.project_id
) max
from
(
select p
.project_id
, p
.employee_id
, e
.experience_years
from Project p
left join Employee e
on p
.employee_id
= e
.employee_id
) t
) tmp
where tmp
.max
= tmp
.experience_years
转载请注明原文地址: https://lol.8miu.com/read-28363.html