Skip to content
Advertisement

How can I group by date time column without taking time into consideration

I have a bunch of product orders and I’m trying to group by the date and sum the quantity for that date. How can I group by the month/day/year without taking the time part into consideration?

3/8/2010 7:42:00 should be grouped with 3/8/2010 4:15:00

Advertisement

Answer

Cast/Convert the values to a Date type for your group by.

GROUP BY CAST(myDateTime AS DATE)
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement