GROUP BY month(myDatefield) YEAR(myDatefield), shouldn't be too crazy =) Remember, in order to group by, you need to select those values as well.
Chris Peterson Gainey IT Adobe Certified Advanced Coldfusion Developer -----Original Message----- From: Ian Skinner [mailto:[EMAIL PROTECTED] Sent: Thursday, November 01, 2007 2:21 PM To: SQL Subject: MS SQL Server: grouping date-time values I have a table with records containing a time-stamp field. I want to query this data grouped by various time ranges such as hour, day, week and month. I want to count and sum data in other fields based on these time ranges. Why syntax am I looking for to parse date time values so that I can group them by various units? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get involved in the latest ColdFusion discussions, product development sharing, and articles on the Adobe Labs wiki. http://labs/adobe.com/wiki/index.php/ColdFusion_8 Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2987 Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6
