SQL語句
描述:exhibitiononline表主鍵exhiid, exhibitor表有外鍵 exhid,對應表 exhibitiononline的主鍵exhiid;
exhibitiononline表---------> 一對多 <------------- exhibitor表
功能:查詢出 exhibitiononline表中,exhiid存在於表 exhibitor中的所有數據,並根據 exhibitor表的exhid的數量排序
select * from exhibitiononline join
(select exhid,count(exhid) as s from exhibitor group by exhid) as t
on exhibitiononline.exhiid=t.exhid
order by t.s desc