排序 让一个表中的数据按照另一个表排序
比如表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