join two columns with different column name(need help)
Hi, I need some help on my tables...i want to display the emp_jobno and the act_jobno as one column.
This is the structure of my tables
empreference
Code:
emp_refno emp_permitno
12 10000000000
15 50000000000
22 40000000000
employee
Code:
emp_id emp_name emp_address emp_jobno emp_refno emp_date
0001 mathias sweeden 10000 12 2011-10-10
0002 Beth england 20000 12 2011-10-12
activity
Code:
actno act_jobno act_status act_date emp_permitno
00001 10010 A 2013-5-12 10000000000
00002 20020 A 2013-2-06 10000000000
The expected output must be like this
Code:
ACTIVITYDATE JOBNO
2011-10-10 10000
2011-10-12 20000
2013-5-12 10010
2013-2-06 20020
and here is my code...
Code:
select act.act_date,emp.emp_jobno,emp.emp_name
from employee emp inner join empreference ref
on emp.emp_refno = ref.emp_refno
inner join activity act
on act.emp_permitno = ref.emp_permitno
where ref.emp_permitno = '10000000000'
but my query did not work...please help me on this.thank you in advance.