I have a table like this:
**customer_id product_id**
1 1234
1 1125
1 6528
2 5645
2 5528
3 4565
And I want to make a query that will give the same information, where each consumer will have one row, and each product_id will be in a separate column, when I do not know how many columns are needed, because each consumer has made a different amount of purchases, This is the result I want:
**customer_id First_product Second_product Third_product **
1 1234 1125 6528
2 5645 5528
3 4565
Note this: How to concatenate text from multiple rows into a single text string in SQL server?
There he does a similar thing, but all the values are in the same column with a comma between them, I want each value to have a separate column.