Hi I'm not good in framing questions. I will try my best. I'm creating a website and my question is related to the queries related to the site.This is the current query that I have.
SELECT
GPS_modem.vehicle_no,
vehicle_log.longitude,
vehicle_log.latitude,
vehicle_log.timestamp
FROM
vehicle_log,
GPS_modem
WHERE
GPS_modem.modem_ID = vehicle_log.modem_ID
ORDER BY
timestamp desc
What I want to display is the entry with the most recent timestamp from the vehicle_log
table where the modem_ID
from the GPS_modem
table matches with the modem_ID
from vehicle_log
table.
I tried using DISTINCT
but I didn't work. I was getting errors when I tried using MAX
function. Hope you are able to understand my question, if then please help me. Thanking you in advance.