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.

Exemplo de resposta esperada

user_idproducts
10[1]
11[1]
12[2]
PostgreSQLv16
Entre para enviar

O resultado da sua consulta aparecerá aqui

Focus radio
Paused · SomaFM · Fluid