>...
> Since our business day starts the previous day at about 11:00 PM
[quoted text clipped - 3 lines]
> the maximum and minimum times is to figure out the time difference
> between them.
If you have a timestamp column containing this information (as opposed
or in addition to a broken out date and time columns), then Sathyaram's
solution will work as he wrote it - the first part of the query can
take care of the overlapping dates. If the dates are broken out, then
the union might work best.
If you have timestamps, you can rewrite Sathyaram's query to do this by
using between, too. Use:
col between timestamp1 and timestamp2 and (time(col + 8 hours) between
0700 and
and 1500)
-Chris
dmeiser - 20 Jul 2006 13:08 GMT
I realized how to do this after some time by doing the following:
Select column1, sum(column2), Max(Time), Min(Time), From (
Select column1, column2, time from file where time <= midnight
Union Select column1, column2, time from file where time >= midnight
and time <= 7:00 AM
) Group By column1 Order by column1