Hi,
I would like to ask someone for help with following SQL. Is there possibility to use NotORM for selecting newest records from table by gps_id ?
SELECT t1.gps_id, t1.machine_id, t1.lng, t1.lat, t1.date,
machine.name FROM gps t1
LEFT JOIN machine ON t1.machine_id =
machine.id INNER JOIN (
SELECT gps_id, MAX(date) AS date FROM gps GROUP BY gps_id
) t2 ON (t1.gps_id = t2.gps_id AND t1.date = t2.date)
Thank you in advance
Karel Uhlik