以下video数据表,实现通过pid分组,并且分组后根据pid的降序排列
使用该语法:
select * from video v1 where(select count(1) from video v2 where v1.pid =v2.pid) order by v1.pid,v1.id;
或:
select * from video v1 where(select count(1) from video v2 where v1.pid =v2.pid) order by v1.pid desc;