Tags / greatest-n-per-group
SELECT DISTINCT ON (label) * FROM products ORDER BY label, created_at DESC;
Get Top 1 Row of Each Group: A Comprehensive Guide to Aggregate Functions and Data Normalization
Finding Maximum Count in SQL: A Comprehensive Guide
Finding Top 2 Customers by Maximum Amount of Transaction in Oracle DB: A Comprehensive Guide
Delete Records from a Table Based on Count and Latest Record