SQL同一张表找出相同数据源中按指定字段分组后最大的一条数据

select A.*,B.x_UserGuid from
(
select
count(CreatedGUID) ss ,max(CreatedTime) maxdate,CreatedGUID
from x_myUserExt
group by CreatedGUID
) A
left join x_myUserExt B on A.CreatedGUID=B.CreatedGUID and A.maxdate=B.CreatedTime

posted @ 2022-07-19 16:07  枫叶轻翔  阅读(355)  评论(0编辑  收藏  举报