SQL Unpivot multiple columns Data
An easier way to unpivot the data would be to use a CROSS APPLY to unpivot the columns in pairs: select vendorid, orders, orders1 from pvt1 cross apply ( select emp1, sa union all select emp2, sa1 ) c (orders, orders1); See SQL Fiddle with Demo. Or you can use CROSS APPLY with the VALUES … Read more