--- Lloyd Thomas <[EMAIL PROTECTED]> wrote:

> Thanks Jay/DRH,
>                             this looks more promising (The "%"
> operator 
> gives you remainder after division). Still not sure how I could apply
> it to 
> start and end unix times.
> The columns I have are :-
> hour start = start time of query for event (unix time)
> hour end = end time of query for event (unix time)
> event time = start time of event(unix time)
> duration = duration of event(seconds)

The modulo concept is simple:

unix time = number of seconds (since 1970 if I remember correctly,
but that's not important)

If you divide the start time, ie. the number of seconds, by 60 and
keep the reminder it tells you the n-th second during each minute
when the event occurred. Which was exactly what I thought you were
looking for.

for example:

event 1 happens at 100 seconds.
event 2 happens at 112 seconds.
event 3 happens at 123 seconds.
event 4 happens at 183 seconds.

100 % 60 = 40  ( 1 minute 40 seconds )
112 % 60 = 52  ( 1 minute 52 seconds )
123 % 60 =  3  ( 2 minutes 3 seconds )
183 % 60 =  3  ( 3 minutes 3 seconds )

select hour_start % 60 as seconds, count(*) as count
 from your_table
 group by seconds

gives this: 

seconds    count
--------   --------
3           2
40          1
52          1

I hope that's what you wanted!

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to