Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/03/2005, 09:34
Avatar de pablinweb
pablinweb
 
Fecha de Ingreso: julio-2003
Mensajes: 283
Antigüedad: 21 años, 9 meses
Puntos: 0
A ver si te sirve!

Si tu campo es fecha hora podrías hacer algo así:

SELECT COUNT(DATEPART(hour, DT_LOAD)) AS Cantidad, DATEPART(hour, DT_LOAD) AS Hora
FROM O_PROSPECTS_DETAIL
WHERE (DT_LOAD >= CONVERT(DATETIME, '2005-03-09 00:00:00', 102)) AND (DT_LOAD <= CONVERT(DATETIME, '2005-03-09 23:59:59', 102))
GROUP BY DATEPART(hour, DT_LOAD)

Donde:
DT_LOAD es tu campo fecha hora
O_PROSPECTS_DETAIL es tu tabla
y tendrías que armar la fecha en la que buscas en ese formato, tambien le puedes agregar la clave del usuario al where.