22,207
社区成员
发帖
与我相关
我的任务
分享
with cte as
(
select 1 id,1 personid,2 EducationOrder
union all
select 2 id,1 personid,1 EducationOrder
union all
select 3 id,2 personid,1 EducationOrder
union all
select 4 id,3 personid,1 EducationOrder
)
select * from cte
/*select * from cte T1
WHERE NOT EXISTS
(SELECT 1 FROM cte T2 WHERE T1.personid=T2.personid AND T2.EducationOrder>T1.EducationOrder)