I have two table (below codes) , want to retrieve last row of trackers_data table and GROUP BY tracker_id and (join) information of each tracker_id from Table Devices
Devices/Table:
/*Table: devices*/
id tracker_id name device_name
-----------------------------------
1 1242 Driver A Benz
2 1255 Driver B Volvo
3 1256 Driver C BMW
Trackers_data/Table:
/*Table: trackers_data*/
id tracker_id longitude latitude
-------------------------------------
5 1255 53.25 11.52
6 1255 52.63 11.63
7 1242 52.23 13.11
8 1242 52.25 15.27
9 1242 54.63 13.86
Example/Results should like below :
/* Results */
id tracker_id lonitude latitude name device_name
6 1255 52.63 11.63 Driver B Volvo
9 1242 54.63 13.86 Driver C BMW
You can use this solution: