Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to change this table

SQL
employeeid  abb                    rate

61          BASIC                  0.00
68          Bus                    50.00
68          BASIC                  100.00
94          BASIC                  5000.00
94          Bus                    1000.00
94          Others                 500.00
96          BASIC                  0.00



into :
SQL
employeeid  Basic      Bus        Others

61          0.00        -          -
68          100.00     50.00       -
94          5000.00    1000.00    500.00
96          0.00        -          -
Posted
Comments
walterhevedeich 26-Nov-13 4:08am    
You need to research about Pivot tables.
rajveer344 26-Nov-13 4:10am    
and also how to insert data in second table...& basic ,bus ,others are not fix,..they can change dynamically.

1 solution

Use PIVOT - UNPIVOT

Using PIVOT and UNPIVOT[^]
Pivoting data in SQL Server[^](Alternate ways)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900