Created
July 24, 2024 05:53
-
-
Save rdapaz/f2a73a9659bc82bcabcaacb5e82a170c to your computer and use it in GitHub Desktop.
Grab latest entry from database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM Summary t1 | |
INNER JOIN ( | |
SELECT system_id, MAX(ID) as max_id | |
FROM Summary | |
WHERE facility = 'MAC' | |
GROUP BY system_id | |
) t2 ON t1.system_id = t2.system_id AND t1.ID = t2.max_id | |
WHERE t1.facility = 'MAC' | |
ORDER BY T1.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment