Given the following information, how can I select the most recent line items (based on time_entered) on unique params and cron_action_id pairs that haven’t been executed?
cron_schedule

For example, ids 1, 2, and 4 have the same params and cron_action_id, so I need not select all 3, just id 4. Same principle for id 3/5 and 7/8.
I can only get so far as
SELECT *
FROM cron_schedule cs
INNER JOIN cron_actions ca
ON cs.cron_action_id = ca.cron_action_id
WHERE time_executed = 0
-- GROUP BY (params, cron_action_id) ?
This should return rows with id 4, 5, 6, and 8
Thanks
1 Answer