sql - how to display the column which is used to join the table -


employee details table

e 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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -