Create Table TEST
(b Int,
a DateTime)
Insert TEST Select 1, '2007-01-03'
Union All Select 1, '2007-01-08'
Union All Select 2, '2007-01-06'
Union All Select 3, '2007-01-03'
Union All Select 3, '2007-02-03'
Union All Select 3, '2007-03-03'
GO
Select COUNT(a) As aa, b From TEST Group By b With Rollup
GO
Drop Table TEST
--Result
/*
aa b
2 1
1 2
3 3
6 NULL
*/