Avarage time between records MySQL

strock

New Member
I have a table that contains records of articles. Now I want to calculate the avarage time between the articles from a source, so I can automaticly increase or decrease my crawler interval. Is that possible with a MySQL Query if I select records from one source between 2 dates?Table layout:\[code\]id | title | description | create_date | source_id -----------------------------------------------------------------1 | Title 1 | A description | 2013-04-09 21:38:00 | 52 | Title 2 | A description | 2013-04-09 22:16:00 | 53 | Title 3 | A description | 2013-04-09 23:54:00 | 5\[/code\]The outcome should be:\[code\]diff between 1 and 3 = 136 min-----------------------------Avarage is 45,33 minutes (crawler interval: 2720 seconds)\[/code\]I could also do this in PHP if that is better!
 
Top