34,571
社区成员
发帖
与我相关
我的任务
分享
试试:
select
*
from
( select *, ROW_NUMBER() over( order by AutoId,order by articleid desc ) row from article as s where 1=1 and not exists(select 1 from article where Publicaccounts=s.Publicaccounts and articleid>s.articleid) ) t
where
row between 1 and 20
select * from article as t where not exists(select 1 from article where Publicaccounts=t.Publicaccounts and articleid>t.articleid) order by articleid desc
SELECT Publicaccounts,
articleid=MAX(articleid)
FROM article
GROUP BY Publicaccounts
order by articleid desc