I have a table "emails":
id | |
---|---|
1 | [email protected] |
2 | [email protected] |
2 | [email protected] |
4 | [email protected] |
2 | [email protected] |
4 | [email protected] |
I need this result:
id | |||
---|---|---|---|
1 | [email protected] | ||
2 | [email protected] | [email protected] | [email protected] |
4 | [email protected] | [email protected] |
the number of columns could expand in future. In fact, in the real database, I have ids with 10 emails already.
Every id, email pair is unique in the table.
I will need to join the resulant table with another table "users" on id.
I'm using Postgres 13.3
This answer is close to my needs, I just need it to be in different columns: https://stackoverflow.com/a/15847245