Code Smarter: Programming for Everyone
Code Smarter: Programming for Everyone
Tags / greatest-n-per-group
SELECT DISTINCT ON (label) * FROM products ORDER BY label, created_at DESC;
2024-12-26    
Using Window Functions to Get the Highest Metric for Each Group
2024-09-27    
Retrieving Maximum Values: Sub-Query vs Self-Join Approach
2024-09-17    
Retrieving the Second Newest Record in SQL Queries Using Window Functions
2024-08-04    
SELECT DISTINCT ON (user_id, activity_type_id, EXTRACT(year FROM start_date_local))
2024-01-10    
Retrieving the Last Production Quantity from a MySQL Query: Two Solutions with Correlated Subqueries and row_number()
2023-09-11    
Code Smarter: Programming for Everyone
Hugo Theme Diary by Rise
Ported from Makito's Journal.

© 2025 Code Smarter: Programming for Everyone
keyboard_arrow_up dark_mode
Hugo Theme Diary by Rise
Ported from Makito's Journal.

© 2025 Code Smarter: Programming for Everyone