I have this table:
F_name | ID | Type | Result |
---|---|---|---|
George | 1 | T-shirt | Y |
George | 1 | Pants | N |
George | 2 | Boots | O |
Dani | 2 | T-shirt | Y |
Dani | 1 | Boots | Y |
I need a SQL server query to merge rows that have the same F_name
and ID
and transpose columns type and result as follows:
F_name | ID | T-shirt | Pants | Boots |
---|---|---|---|---|
George | 1 | Y | N | null |
George | 2 | null | null | O |
Dani | 2 | Y | null | null |
Dani | 1 | null | null | Y |