Código SQL:
Ver originalCREATE TABLE #temp
(
dia datetime,
nombre VARCHAR(20)
)
INSERT INTO #temp VALUES(
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','asilva')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','asilva')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','asilva')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','jguerrero')
INSERT INTO #temp VALUES('2011-10-26 00:00:00.000','jguerrero')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','jguerrero')
INSERT INTO #temp VALUES('2011-10-26 00:00:00.000','jguerrero')
INSERT INTO #temp VALUES('2011-10-26 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-26 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-26 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','privera')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','psalcedo')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','psalcedo')
INSERT INTO #temp VALUES('2011-10-24 00:00:00.000','psalcedo')
SELECT COUNT(nombre) AS dias,nombre FROM
(SELECT dia, nombre FROM #temp GROUP BY dia,nombre) t1 WHERE t1.dia BETWEEN '2011-10-01' AND '2011-10-30'
GROUP BY nombre
Saludos!