Link to home
Start Free TrialLog in
Avatar of r_pat72
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.
SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
select empid, Year = '2008', 2008Scores as ScoreValue
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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial