Details |
Last modification |
View Log
| RSS feed
| Rev |
Author |
Line No. |
Line |
| 9 |
rodolico |
1 |
Clean up the computer uptime with something like this
|
|
|
2 |
|
|
|
3 |
create temporary table test like computer_uptime;
|
|
|
4 |
insert into test select
|
|
|
5 |
null,
|
|
|
6 |
device_id,
|
|
|
7 |
timestamp( date(last_reboot), sec_to_time(time_to_sec( last_reboot ) DIV 300 * 300) ),
|
|
|
8 |
min(added_date),
|
|
|
9 |
max(removed_date)
|
|
|
10 |
from
|
|
|
11 |
computer_uptime
|
|
|
12 |
group by
|
|
|
13 |
device_id,
|
|
|
14 |
timestamp( date(last_reboot), sec_to_time(time_to_sec( last_reboot ) DIV 300 * 300) );
|
|
|
15 |
delete from computer_uptime;
|
|
|
16 |
insert into computer_uptime select * from test;
|
|
|
17 |
drop table test;
|
|
|
18 |
|