I tried the below query to display data
select e.Name,ic.Code,t1.pyear,t1.pmonth,t2.Amount
from t1
inner join t2 on t2.id=t1.id
inner join t3 on t3.Code=t2.Code
inner join t4 e on t4.employeeindex=t1.employeeindex
where t1.pyear=2016 and t1.pmonth=1
union all
select e.Name,ic.Code,t1.pyear,t1.pmonth,t2.Amount
from t1
inner join t2 on t2.id=t1.id
inner join t3 on t3.Code=t2.Code
inner join t4 e on t4.employeeindex=t1.employeeindex
where t1.pyear=2016 and t1.pmonth=2
and the data i am getting is like this-
scode amount month year e_name
abc 3847 1 2016 john
ABC 20938 2 2016 john
XYZ 2838 1 2016 david
XYZ 29384 2 2016 david
now i want to display data like this
s_code amount1 amount2 month1 month2 year e_name
abc 3847 20938 1 2 2016 john
xyz 2838 29384 1 2 2016 david
any solution ?