r_pat72
asked on
Sql server 2008 query help
Hi,
i have a following table. I want to display some column as rows. Please help me achieving this.
Here is the sample table
EmployeeTable
---------------
EmpID 2008Scores 2009Scores 2010Scores
2 12 14 18
I want the result like this
EmpID Year ScoreValue
2 2008 12
2 2009 14
2 2010 18
Please help.
Thanks.
i have a following table. I want to display some column as rows. Please help me achieving this.
Here is the sample table
EmployeeTable
---------------
EmpID 2008Scores 2009Scores 2010Scores
2 12 14 18
I want the result like this
EmpID Year ScoreValue
2 2008 12
2 2009 14
2 2010 18
Please help.
Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
where empid = 2
union
select empid, Year = '2009', 2009Scores as ScoreValue
where empid = 2
union
select empid, Year = '2010', 2010Scores as ScoreValue
where empid = 2