Novice user.
I have two tables:
personnel(personnel_id, employee_id, f_name, l_name, initials, department, role),
track(track_id, personnel_id, status, time_in, time_out, location)
"A person can be tracked many times"
To attempt to render just the required parts of the data set, I am using the query:
SELECT
personnel.personnel_id,
personnel.employee_id,
personnel.l_name,
personnel.initials,
track.status,
track.time_in,
track.time_out
FROM
personnel, track
WHERE
personnel.personnel_id = track.personnel_id
ORDER BY
l_name
The issue here is that it returns every instance of the foreign key's appearance in the track
table when all I need it to do is display the personnel details with the most recently inserted track data. It also returns the same personnel data multiple times per occurrence of the foreign key. I know the problem lies in the query and I have ventured into JOINS but I'm still in beginner land.