Hello,

I am relatively new to php, and have a question regarding polling a 
mysql database and defining groups of data:

Say I have a table that looks like this:

Time        |  Speed
--------------------
1016278580  |   0
1016278582  |   0
1016278584  |   0
1016278586  |   3
1016278588  |   7
1016278590  |   5
1016278592  |   4
1016278594  |   0
1016278596  |   0
1016278598  |   2
1016278600  |   0


Now, the time is epoch time. Speed is MPH (so 0 means I am stopped). 
What I want to do is make a call into mysql that will return to me when 
I stopped, and for how long. IE:

You stop at 1016278580 for 6 seconds (calculated until speed !=0).
You also stopped at 1016278594 for 4 seconds
You also stopped at 1016278600 , and are still stopped (or something 
like that)

Whats the best way to do this? I can query the database for every row 
where speed = 0, but how do I make the distinction between the groups 
of 0's (IE, in the example above I would essentially have 
three "groups" of zeros that I would need to identify). Is there 
someway to pull the data out of mysql in this format (Select * WHERE 
speed=0 UNTIL speed !=0)? Something like that? Or would this be better 
handled by PHP after pulling the data out of mysql?

Any help I can get on this would be greatly appreciated.

Thanks.

-Jeff


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to