The sub-totals appear below each group only because "T...." is larger than "M" or "F". For the sake of the purists, adding an order by would be more apt.
PHP Code:
SELECT [CUSTABLE].[Dept], [CUSTABLE].[Gender], [CUSTABLE].[Pop]
FROM
(SELECT [Dept], 1 As [Order], [Gender], Count(*) as Pop
FROM [Employee] GROUP BY [Dept], [Gender]
UNION SELECT [Dept], 2 As [Order], "Total", Count(*) as Pop
FROM [Employee] GROUP BY [Dept]) CUSTABLE
ORDER BY [CUSTABLE].[Dept], [CUSTABLE].[Order];
Bookmarks