我目前正在开发一个java应用程序,它可以让我获得每个移动网络运营商的订户数量。 为此,我创建了一个表,其中包含我称之为 indicatifs 的所有运算符,它包含 3 行:国家/地区、运算符和 mobile_prefix。 我的第二个表名为 subs,包含两行:mobile_prefix 和订阅者数量 我应该使用什么查询才能得到这样的结果:
Operator Country Number of Subscribers
SFR France 20000
T-Mobile USA 10250
Telia Sweden 5248
.. 任何形式的帮助将非常感激。 谢谢!
最佳答案
试试这个方法
select a.country, a.operator, count(*) as subscriber
from indicatifs a
left join subs b
on a.mobile_prefix = b.mobile_prefix
group by a.operator, a.country
关于java - 如何使用 2 个表获取订阅者数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36839023/