Per-group FIRST_VALUE / MIN subquery to classify entities
For the vendor rationalization review — for every vendor with 2025 posted spend, classify them as 'new' (their first-ever txn is in 2025) or 'recurring' (earlier history). Columns: `vendor_name`, `total_spend_2025`, `vendor_status`.
Each hint you reveal reduces the XP you can earn. Try the query first.
First compute each vendor's earliest txn year: `MIN(EXTRACT(YEAR FROM txn_date::date))` grouped by vendor_id.
Join that back to 2025 spend per vendor (posted only).
CASE WHEN first_year = 2025 THEN 'new' ELSE 'recurring' END.