How to get result in the row instead of column. Thank you
This is my sql query and output
select a.EMPLOYEE, a.LAST_NAME, a.FIRST_NAME, DATEDIFF(YEAR,b.BIRTHDATE, c.START_DATE) as Age,
b.BIRTHDATE, c.START_DATE, c.PLAN_CODE, c.SMOKER, c.EMP_AFT_CONT, c.COV_OPTION
from EMPLOYEE a
right outer join PAEMPLOYEE b on a. EMPLOYEE = b.EMPLOYEE
right outer join (Select distinct EMPLOYEE, START_DATE, PLAN_CODE, SMOKER, EMP_AFT_CONT, COV_OPTION from BENEFIT
where PLAN_CODE in ('GAP1', 'CI01', 'CI21'))c
on a.EMPLOYEE = c.EMPLOYEE
order by EMPLOYEE, START_DATE
EmpID Name Age Start_Date Plan_Code Smoker EmpRate CoverOption
1049 John Doe 59 2014-01-01 GAP1 Y 623.00 3
1049 John Doe 59 2014-01-01 CI21 N 422.08 3
1049 John Doe 60 2015-01-01 CI21 N 288.20 2
1049 John Doe 60 2015-01-01 CI01 Y 488.402 3
1049 John Doe 60 2015-01-01 GAP1 N 250.20 22**************************************************************
I WANT OUTPUT LIKE THIS
EmpID Name Age StartDate Plancode Smoker EmpRate CoverOpt
1049 John Doe 59 2014 GAP1 Y 623.00 3
CI21 N 422.08 3
1049 John Doe 60 2015 CI21 N 288.20 2
CI01 Y 488.40 3
GAP1 N 250.20 3
AND SO ON...