Created
January 25, 2024 01:24
-
-
Save mihow/a2b094dfe1caf76ea8b723ba46e9c315 to your computer and use it in GitHub Desktop.
5 example matching rows for each category in a joined table (PostgreSQL)
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 c.category_name, i.image_id FROM categories c | |
CROSS JOIN LATERAL ( | |
SELECT image_id | |
FROM image_hashes v | |
WHERE v.category_id = c.category_id | |
LIMIT 5 | |
) i; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment