Cyrille Belco Ier Cyrille Belco Ier - 4 months ago 35
SQL Question

Select the last entry of each group

I would like the last record in each group member. but with this application, I get rather the first two entries. I feel like Max (time) does not work

SELECT id, latitude, longitude, MAX(temps), vitesse, description, id_recepteur
FROM donneesgps
GROUP BY id_recepteur

Please help


Assuming that temps is time, you want where, not group by:

FROM donneesgps d
WHERE d.temps = (SELECT MAX(d2.temps)
                 FROM donneesgps d2
                 WHERE d2.id_recepteur = d.id_recepteur