Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cross Tabs Report Showing count by Hour Per Day

Status
Not open for further replies.

CBaber

Technical User
Oct 5, 2000
4
US
I need to have a count of items per hour through the day in a row and a colume by day
12/1 12/2 12/3
12am 1 2 5
1am 0 1 3
2am 0 0 0
...
8am 9 12 15
...
2pm 6 8 9


I put the date in the row ascending by hour and the date in the colume ascending by day and get the result verticaly and then horizontally.
Thanks for any advice!
 
The data was by day and growing vericaly down the page with only one hour showing on the horizontal line. What I resolved to do was in a view:
select CONVERT(char(10), ORDER_DATE, 101) As Order_Date, DATEPART(hh, ORDER_DATE) As Order_Hour, COUNT(1)As Order_Cnt, SUM(ORDER_TOTAL) As Order_Sum
FROM mccatalog.dbo_ORDERS
WHERE STATUS LIKE 'ORDERED' OR
STATUS LIKE 'SEE DETAILS' OR
STATUS LIKE 'SHIPPED'
GROUP BY CONVERT(char(10), ORDER_DATE, 101), DATEPART(hh, ORDER_DATE)

then building the cross tab report.
Works like a charm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top