I have the data:
(this forum blows chunks as it seems to trim all whitespace)
id..............account_num........firstname.....lastname....phone type.......phone number
132...........8547809..............MICHAEL......CLARK........1.....................5555555555
132...........8547809..............MICHAEL......CLARK .......4.....................9999999999
I'm trying to create 1 row for that with the columns
id..............account_num........firstname........lastname.....homephone.......worknumber
132............8547809..............MICHAEL.........CLARK........5555555555......9999999999
But I can't seem to get the PIVOT command to work and do that. Is it just not possible with PIVOT? The phone type is basically the pivot field. Depending on the phone type depends if its home/work, etc.
Can anybody lead me down the path to pivot this correctly?
(this forum blows chunks as it seems to trim all whitespace)
id..............account_num........firstname.....lastname....phone type.......phone number
132...........8547809..............MICHAEL......CLARK........1.....................5555555555
132...........8547809..............MICHAEL......CLARK .......4.....................9999999999
I'm trying to create 1 row for that with the columns
id..............account_num........firstname........lastname.....homephone.......worknumber
132............8547809..............MICHAEL.........CLARK........5555555555......9999999999
But I can't seem to get the PIVOT command to work and do that. Is it just not possible with PIVOT? The phone type is basically the pivot field. Depending on the phone type depends if its home/work, etc.
Can anybody lead me down the path to pivot this correctly?
