PostgreSQL Pilih Top 1 dari masing -masing grup
SELECT rank_filter.* FROM (
SELECT items.*,
rank() OVER (
PARTITION BY color
ORDER BY created_at DESC
)
FROM items
WHERE items.cost < 50
) rank_filter WHERE RANK = 1
Zaur Tskhvaradze