The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Invoke: SQL gurus. by Tomo 2008-09-15 05:52:04
I have a table that contains a list of events, and I'd like to find the mean interval between successive events of a given type for each 'Object'.

Table Format:
Object_Id, Event_Type, Timestamp

While I could programmatically step through every record to do this, there must be a better way!

The core issue I'm having is that I can't figure out how to get DATEDIFF() to use the date of the previous record as one argument.

(Server is MySQL if it makes any difference)
[ Reply ]
  You can't with a straightforward SELECT I don't by sazzer2008-09-15 06:00:45
  You can't. by Arachnid2008-09-15 06:15:28
    Dammit. by Tomo2008-09-15 06:56:16
      Can MySQL do cursors? by MatthewDBA2008-09-15 07:44:15
        Yes it can, in the context of stored procedures. by Tomo2008-09-15 08:42:50

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)