I'm looking for an efficient way to convert rows to columns in SQL server, I heard that PIVOT is what I'm searching for, and I'm new to pivot tables.
This is my example:
ItemID VendorName VendorPrice
122 HP 125.66
122 Apple 130.44
122 Microsoft 134.00
122 IBM 124.90
This is my expected result:
ItemID HPPrice ApplePrice MicrosoftPrice IBMPrice
122 125.66 130.44 134.00 124.90
How can I build the result using pivot tables?