Create table a
(ID Int,
[Time] Varchar(10))
Insert a Select 1, '2006.1.1'
Union All Select 1, '2006.1.1'
Union All Select 1, '2006.2.1'
Union All Select 2, '2006.1.1'
Union All Select 2, '2006.1.1'
Union All Select 2, '2006.1.2'
Union All Select 3, '2006.1.2'
GO
Select
Count(Distinct ID) As 总数,
[Time]
From
a
Group By
[Time]
GO
Drop Table a
--Result
/*
总数 Time
2 2006.1.1
2 2006.1.2
1 2006.2.1
*/