DISTINCT subcategories with a JOIN to a dim table
I'm prepping the LO comp grid and need the loan product list off `retail_products`. Pull every product where `category = 'Loan'` — three columns: `product_code`, `product_name`, `subcategory`. Sort by `subcategory` then `product_code`.
| Column | Type | Key |
|---|---|---|
| product_id | INT | PK |
| product_code | TEXT | |
| product_name | TEXT | |
| category | TEXT | |
| subcategory | TEXT | |
| default_apr | REAL |
Each hint you reveal reduces the XP you can earn. Try the query first.
`retail_products` mixes deposits, cards, and loans in one dim. You want the loan rows only — restrict the population on the category column before anything else.
Three projected columns in the order the briefing dictates. The two-key sort (subcategory first, then code) is what gives ties between products in the same subcategory a deterministic order.
Everything you need is on `retail_products` — no JOIN involved. Filter, project, sort. That's the whole query.