打赏

sql分组获取第一条或者最小一条值

很多人都在问这个问题,现在记录一下

 

select id from test as a
where id = (select min(b.id )
from test as b
where a.pid = b.pid);

 

posted @ 2018-09-12 11:27  Bear.Tirisfal  阅读(1745)  评论(0编辑  收藏  举报