I have a table like this;
Table: PROSPECT
ID CUSTOMER NUMBER
1 A XXXA1
1 B XXXA1
1 G XXX00
2 C XXX32
2 D XXX32
2 E XXX32
2 F XXX66
I want to combine rows’ customer’s name with ; where they has same ID and NUMBER. (and delete other rows.)
I want to it like this;
Table: PROSPECT
ID CUSTOMER NUMBER
1 A;B XXXA1
1 G XXX00
2 C;D;E XXX32
2 F XXX66
How can I do that?
Disclaimer
I agree with @Dems that you should not change your normalized data to this.
A better alternative might be to create a
VIEWthat presents you the data in the format you need.SQL Statement
Test script