0

I need help please.

I am coding a gps tracking app, for now i have 2 cars in my database they have id 1 and 2. I want to extract their last position (latitude and longitude) according to the time at which they were recorded. screenshot of the table called "position"

I have tested this request " select * from position where id_vehicule=1 order by date_et_heure desc limit 1" obviously it returns the last record of vehicle 1 (line4) (*date_et_heure corresponds to the time at which the position was recorded)

but i want an sql request that will return lines 4 and 5, corresponding to the last positions of vehicle 1 and 2 respectively screenshot of the table called "position"

And if it happens that i add another vehicle in the database i want the request to also return its last position.

MJT
  • 1

0 Answers0