demo for Multiple Counts from the same row with range
Q&A about the site for Drupal developers and administrators
-- counts per day -- demo for Multiple Counts from the same row with range declare @trans table (operationId int primary key, dt datetime) insert INTO @trans values (1,'2011-11-11 10:00'),(2,'2011-11-11 11:00') SELECT operationId, cast(dt As date) AS mydate, COUNT(*) AS trans FROM @trans -- WHERE hitTime BETWEEN '2011-10-14 00:00:00' AND '2011-10-14 23:59:59.99' group by operationId, cast(dt As date);