sql - how to display the column which is used to join the table -
i have 2 tables this, query display list of empid & name of employees least working hours per month id
the o/p should this.
moth_ending emp_id name 20150131 1001 baba 20150228 1001 baba 20150331 1001 baba
i tried code.
select month_ending,name,total_workinghours employee_details left join dim_employee on employee_details.emp_id = dim_employee.emp_id
learn use table aliases. think want:
select ed.month_ending, ed.emp_id, e.name employee_details ed left join dim_employee e on ed.emp_id = e.emp_id;
i don't see why left join
necessary. if database set employee_details
should refer valid employee.
Comments
Post a Comment