Change level(s) of totals with GROUP BY
(You don't say which DBMS, but inferring SQL Server from your temporary table name..)

If you're on a recent enough version (>=2008 ?) you can achieve the fine level of rollup control you're after with GROUPING SETS. For your 2nd query, the equivalent would be:

SELECT a,b,c, COUNT(*)
FROM #TEMP
GROUP BY GROUPING SETS ((a,b,c),())