I'm looking for an efficient way to convert rows to columns in the SQL server, I heard that PIVOT is not very fast, and I need to deal with a lot of records.
I tried following on this Efficiently convert rows to columns in sql server but still not solved with my below example
This is my example: (updated)
   -----------------------------------------------
   | Id | Value  | ColumnName    | Submission_Id |
   -----------------------------------------------
   | 1  | John   | FirstName     | 1             |
   | 2  | 2.4    | Amount        | 1             |
   | 3  | ZH1E4A | PostalCode    | 1             |
   | 4  | Fork   | LastName      | 1             |
   | 5  | 857685 | AccountNumber | 1             |
   | 6  | Donny  | FirstName     | 2             |
   | 7  | 2.7    | Amount        | 2             |
   | 8  | ZH1E4C | PostalCode    | 2             |
   | 9  | Yen    | LastName      | 2             |
   | 10 | 857686 | AccountNumber | 2             |
   -----------------------------------------------
This is my expected result:
---------------------------------------------------------------------
| FirstName  |Amount|   PostalCode   |   LastName  |  AccountNumber |
---------------------------------------------------------------------
| John       | 2.4  |   ZH1E4A       |   Fork      |  857685        |
| Donny      | 2.7  |   ZH1E4C       |   Yen       |  857686        |
---------------------------------------------------------------------
How can I build the result?
 
     
    