CREATE TABLE #yt (Emp1 INT, Emp2 INT, Emp3 INT, Emp4 INT,...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Bicycles

Q&A for people who build and repair bicycles, people who train cycling, or commute on bicycles

CREATE TABLE #yt (Emp1 INT, Emp2 INT,  
    Emp3 INT, Emp4 INT, Emp5 INT);
   
INSERT INTO #yt VALUES (4,3,5,4,4);  

SELECT Employee, Orders  
FROM   
   (SELECT Emp1, Emp2, Emp3, Emp4, Emp5  
   FROM #yt) p  
UNPIVOT  
   (Orders FOR Employee IN   
      (Emp1, Emp2, Emp3, Emp4, Emp5)  
)AS unpvt;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results