In my SqlServer 2008, I have a table named Table1, with one column named IncDate which is a DateTime.
I need to run a query which returns the total of records by that date. For example, my table has these records:
IncDate
09/09/2012 16:21:51.547
09/09/2012 16:22:11.032
10/09/2012 13:51:33.327
My query needs to output:
Date................Total
09/09/2012...........2
10/09/2012...........1
You need to
CAST()the date as date-only.see SQL Fiddle with Demo
If you do not
CAST()the date to date-only, then the counts will be off.