mysql - How to calculte average time difference between lines? -


i have mysql table 'totolog' :

id  dt                    data 1   2013-05-01 06:01:01   hi john   2   2013-05-01 06:04:23   hi bob   3   2013-05-01 07:17:36   hi alex   4   2013-05-01 14:49:41   hi   

how can retrieve average time difference between lines ?

i suspect this

select unknow_function(dt) totolog order dt asc; 

the average time time_max - time_min / number_of_records

select (max(dt) - min(dt)) / count(dt) avg_dt totolog  order avg_dt asc; 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -