On 5/24/2012 11:46 AM, IQuant wrote:
ie. I have a table with 1,000,000 + records collecting real time
stats from many devices with many columns but the main ones of
interest are 'timestamp', 'latency' and 'DeviceID'.
2012-05-01 13:12:11.103 Null 14356
2012-05-01 13:12:11.103 Null 14372
2012-05-01 13:12:11.103 Null 4356
2012-05-01 13:12:07.103 Null 14356
.....
2012-05-01 13:12:11.221 Null 14356
I want to update the latency field for each record with the latest
previous timestamp for the same DeviceID.
update MyTable set latency = (
select max(t2.timestamp) from MyTable t2
where t2.DeviceId = MyTable.DeviceId and t2.timestamp <
MyTable.timestamp);
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users