Sql - Rolling up multiple rows to one row

68 Views Asked by At

I have a dataset as follows;

enter image description here

I need to display the data on row per customer as follows;

enter image description here

I'm not proficient at all at sql so any help would be greatly appreciated.

AD

1

There are 1 best solutions below

0
brillar_duke On

The answer to your problem can be solved by unpivoting the data. The UNPIVOT in sql can help but for that need certain info to identify the constraints, How many accounts does one customer can have, If a customer has 2 acct and other has 3 acct so what should be populated for acct 3 column for first customer