Използвайте WITH ROLLUP
модификатор на GROUP BY
:
SELECT IFNULL(env, 'Unknown'),
COUNT(*) AS Count
FROM env_table
GROUP BY env WITH ROLLUP
ORDER BY env
Използвайте WITH ROLLUP
модификатор на GROUP BY
:
SELECT IFNULL(env, 'Unknown'),
COUNT(*) AS Count
FROM env_table
GROUP BY env WITH ROLLUP
ORDER BY env