I have SNOWFLAKE database table with customers and their transaction types:
customer_id type
1 a
1 a
2 b
2 b
2 b
3 a
3 b
3 a
At output I need distinct customer id and type of transaction:
customer_id type
1 a
2 b
3 mixed
My code does not work:
SELECT
"customer_id",
CASE WHEN type = 'a' THEN "a"
WHEN type = 'b' THEN "b"
ELSE "mixed" END OVER (PARTITION BY "customer_id" ) AS "type"
FROM CUSTOMERS