This will GROUP BY and SELECT a datetime value "rounded" to the hour. You should use your frontend application to display the value as you like:SELECT dateadd(hour, datediff(hour, 0, [time]), 0) as Hour, SUM(Total) as Sales, count(TransactionNumber) as Customers, SUM(Total)/count(TransactionNumber) as 'Ave Sale'FROM [transaction] WHERE time between '05/30/2008' and '05/31/08'GROUP BY datediff(hour, 0, [time])
Be One with the OptimizerTG