join - need help joining two tables, sql -
i've searched stackoverflow not reply question.
table 1 has 2 columns
employee_id employee_nametable 2 has 2 columns
employee_id manager_idmanager_id subset of employee_id, in turn means manager's name available in employee_name list.
how bring together both tables result : employee_id, employee_name, manager name.
my query :
select employee_id, employee_name, manager_id manager_name table1 left bring together table2 on table1.employee_id = table2.employee_id manager_id = employee_id;
please , suggest appropriate approach situation.
thanks in advance.
you need bring together table1
:
select employees.employee_name.employee_id, employees.employee_name, managers.employee_name manager_name table1 employees left bring together table2 on table2.employee_id = employees.employee_id left bring together table1 managers on managers.employee_id = table2.manager_id
additionally, since you're filtering downwards matching managers through join
clauses, can exclude where
original query.
sql join oracle-sqldeveloper
No comments:
Post a Comment