Hi,
This may well be very obvious to some but here goes anyway....
I want to summarise orders received throughout the day by hour. I want my report to show every how from 8am to 8pm regardless of whether orders were recieved within those hours.
So:
8 = 0
9 = 5
10 = 12
11 = 4
12 = 0
13 = 1 etc etc
Currently to do this I have created a simple file named TIME which contains 13 records 8 through to 20. I summarise my order data by hour and then join from TIME using a LEFT OUTER JOIN to the summarised order data.
This works fine, but I would like to know if I can skip the step of having to have the TIME file actually residing in our system and to be able to do the whole query within SQL without the need to ship a new file to each environment we run it in.
So something like this:
Cheers
Mark
This may well be very obvious to some but here goes anyway....
I want to summarise orders received throughout the day by hour. I want my report to show every how from 8am to 8pm regardless of whether orders were recieved within those hours.
So:
8 = 0
9 = 5
10 = 12
11 = 4
12 = 0
13 = 1 etc etc
Currently to do this I have created a simple file named TIME which contains 13 records 8 through to 20. I summarise my order data by hour and then join from TIME using a LEFT OUTER JOIN to the summarised order data.
This works fine, but I would like to know if I can skip the step of having to have the TIME file actually residing in our system and to be able to do the whole query within SQL without the need to ship a new file to each environment we run it in.
So something like this:
Code:
CREATE TEMP TABLE TIME (HOUR/A2) INSERT RECORDS (1, 2, 3, 4, 5, 6, 7, 8 ETC) SELECT HOUR, SUM(ORDERS) FROM TIME LEFT OUTER JOIN ORDERFILE ... ... GROUP BY HOUR
Mark




Comment