B表中的pid对应A表中id,查询A表中数据,根据b表中对应a表中该id的数据数目排序
select a.*,count(*) as c from a left join b on a.id=b.aid group by a.id ORDER BY c desc
2023-12-02 19:42:16
B表中的pid对应A表中id,查询A表中数据,根据b表中对应a表中该id的数据数目排序
select a.*,count(*) as c from a left join b on a.id=b.aid group by a.id ORDER BY c desc
下一篇:JS操作JSON