Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
574 views
in Technique[技术] by (71.8m points)

mysql不同表数据求和并排序问题

主表 a
收入表 b b.a_id=a.id 有多条a_id数据
导入收入表 c c.a_id=a.id 有多条a_id数据

laravel写的,以前功能都有,现在要做个排行榜,要求表a的各个id的总收入并降序排序,不合并表bc的情况下,mysql该怎么查


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

啥叫不合并表?(不连表?)
直接连表分组统计就行了
非要不连表,子查询也能做


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...