I want to create an average time difference between device connections.
Now I have this request thanks to ajreal. Now I need to create an average time between each device record.
select device, count(*) as cnt, max(time) from database.table group by device having cnt>1 order by device;
I played with TIMEDIFF, but I need the average value between all device entries, not just min and max.
The table is structured as follows:
ID, device(string), data1(int),data2(int), time(timestamp), data3(int), data4(int)
How can I achieve my goal?
This is a table definition.
Field Type Null Key Default Extra
id int (11) NO PRI NULL auto_increment device varchar (15) NO MUL NULL
data1 decimal (5,2) YES NULL
data2 decimal (5,2) YES NULL
timestamp YES NULL
data3 decimal (3.0) YES NULL
data4 decimal (3.0) YES NULL
Thanks for looking at my problem @ Chris Henry!
source share