Open jayachandranm opened 8 years ago
Can be by time range, eg limit to last hour/day. If limit by number of rows, increase in number of devices can give unexpected results, missing some of the devices in effect.
SELECT * FROM (
SELECT * FROM obd_gps ORDER BY TIMESTAMP DESC ) AS a GROUP BY sid
obd_gps
SELECT * FROM obd_gps WHERE TIMESTAMP IN (
SELECT MAX( TIMESTAMP ) FROM obd_gps GROUP BY sid )
Can be by time range, eg limit to last hour/day. If limit by number of rows, increase in number of devices can give unexpected results, missing some of the devices in effect.