在 pubs 数据库中,我想查询销售质量最高的商店。我执行以下查询,
select stores.stor_id, sum(sales.qty) as sumqty
from stores
join sales on stores.stor_id = sales.stor_id
group by stores.stor_id, stores.stor_name
结果:
+-------+------+
|stor_id|sumqty|
+-------+------+
|6380 |8 |
+-------+------+
|7066 |125 |
+-------+------+
|7067 |90 |
+-------+------+
|7131 |130 |
+-------+------+
|7896 |60 |
+-------+------+
|8042 |80 |
+-------+------+
我需要的结果就像
+-------+------+
|stor_id|sumqty|
+-------+------+
|7131 |130 |
+-------+------+
你能给一些建议吗?谢谢。