Tags / greatest-n-per-group
SELECT DISTINCT ON (label) * FROM products ORDER BY label, created_at DESC;
Understanding the Limitations of SQL's LIMIT Function: Alternatives for Microsoft SQL Server
Using Arrays for Conditional Aggregation in BigQuery: A Pivot Table Solution
Finding OID with Start and Stop Encompassing Connect and Disconnect Dates in SQL
Querying Single Rows in a Table with Multiple Rows in a Subquery Using Row Number and Aggregate Functions
Get Top 1 Row of Each Group: A Comprehensive Guide to Aggregate Functions and Data Normalization
Understanding the Problem and the Proposed Solution for Retrieving Specific Rows in SQL
Using Window Functions to Get the Highest Metric for Each Group
Retrieving Top 1 Row per Group: A Flexible Approach to Data Analysis
Understanding SQL Server's SELECT DISTINCT Query Conundrum: A Guide to Efficient Duplicate Row Elimination