TA贡献1784条经验 获得超9个赞
select a.id, (select count(*) from b where b.aid = a.id) c
from a
order by c asc|desc
TA贡献1946条经验 获得超3个赞
select * from a order by (select Id,count(*) as count from b group by Id);试试!!!
10+年DBA老司机带你轻松玩转 SQL
¥ 48.00
举报