SQL newest row per category
Select the most recently created row in each category using a window function.
Original Pearto instructional example. Test it in your own environment and adapt it to your requirements.
WITH ranked AS (
SELECT id, category, created_at,
ROW_NUMBER() OVER (PARTITION BY category ORDER BY created_at DESC, id DESC) AS rn
FROM resources
)
SELECT id, category, created_at FROM ranked WHERE rn=1;