这很简单,但无法弄清楚。
这是我的表
a b
---------
s1 prod
s2 prod
s3 dev
s4 prod
s5 dev
我期待的是如下
Environment count
prod 3
dev 2
total 5
因此,环境领域的小组也在寻找总数。
答案 0 :(得分:0)
更新:
SELECT b AS Environment, COUNT(a) AS COUNT FROM <tablename> GROUP BY b UNION SELECT 'total' AS Environment, COUNT(a) AS COUNT FROM <tablename>;
它可能对你有帮助