Each user's set of products
Each user's set of products
From the events table (columns user_id, product_id, event_type, ts) build, for each user_id, a sorted array of the distinct product_id values they interacted with. Return columns user_id and products (array sorted ascending). Order the result by user_id.
Expected output sample
| user_id | products |
|---|---|
| 10 | [1] |
| 11 | [1] |
| 12 | [2] |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inFocus radio
Paused · SomaFM · Fluid