Link to home
Start Free TrialLog in
Avatar of jhonc66
jhonc66Flag for Australia

asked on

Join Tables in SQL

Hello I have the following query which is giving me the data from the people not working on Today.

SELECT *
FROM q2employee_work_schedule
WHERE working = 'N' AND date1 = CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME)

 but is giving me an employee Code "emp_code" which is fine but I need a name, there is another table called dbo.q2employees, how can I join these two tables to get the preferred name "preferred_name"  and surname

Thanks
Avatar of Pratima
Pratima
Flag of India image

SELECT q2employee_work_schedule.* ,q2employees.*
FROM q2employee_work_schedule
Inner join q2employees on q2employee_work_schedule.emp_code =q2employees.emp_code
WHERE working = 'N' AND date1 = CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME)
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jhonc66

ASKER

Thanks a lot