作者:书友80922185 | 来源:互联网 | 2017-05-14 01:33
比如表A有字段
id ,name
2 test
表B有字段 A表中的id等于B表中的 location_id
id uid location_id num
1 1 2 5
2 3 2 6
3 4 3 1
如何写sql语句让表A中的数据 按照表B中 num 排序 而且是总计的num 排序
回复讨论(解决方案)
select A.id,A.name from B inner join A on B.location_id = A.id order by B.num desc
谢谢你的热心回答