Skip to content

Instantly share code, notes, and snippets.

@jaraco
Created July 6, 2018 21:27
Show Gist options
  • Save jaraco/0b7d8933d3355fcaa2d82aef127023f7 to your computer and use it in GitHub Desktop.
Save jaraco/0b7d8933d3355fcaa2d82aef127023f7 to your computer and use it in GitHub Desktop.
SELECT TARGETS.*, TASKS.LAST_HARVESTED
FROM TARGETS
LEFT OUTER JOIN (
SELECT TARGET_ID, max(HARVESTED) LAST_HARVESTED
FROM TASKS
GROUP BY TARGET_ID
) TASKS
on TARGETS.ID = TASKS.TARGET_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment