I have a history table which I would like to use to find the latest user in which updated specific items. Here is the query I have so far:
SELECT *
FROM `history`
WHERE `pKey`
IN ( 13309, 13311, 13951, 14244, 1500, 15558, 15691, 15938, 9769 )
ORDER BY `history`.`time` DESC
LIMIT 0 , 30
This returns multiple history results for each pkey. Is there a way to limit the results to only the latest (based on time) entry from the specific pkey?
So for example: Right now pkey 13309 has multiple results returned. The query should only return the latest result for it. Same goes for 13311... etc.