HI I have a table EMP_SCHED which contains COMMENTS Column for EMP_ID and another table SHIFT which also contains COMMENTS column for EMP_ID.Now for a given date range I need to pick COMMNETS from both tables .
For example in I have 7 EMP_IDs in EMP_SCHED table and 2 EMPIDs in SHIFT .I need all the EMPIDS and COMMNETNS and place the comments for common EMPID from both tables in single row
I thought of place join first on EMP_SCHED then on SHIFT but they returned multiple rows
SELECT distinct E.[EMP_ID]as SCHED_EMP,S.EMP_ID as SHIFT_EMP,
E.[SCHED_COMMENT],S.COMMENTS
FROM [EMP_SCHED_COMMENT] E, SHIFT S
where e.emp_id =*s.emp_id
The output looked
NULL 33018 NULL Truck Delivery
NULL 33029 NULL Order Beer/Wine
NULL 33067 NULL Deli Shift Available
NULL 33115 NULL Clean backroom
NULL 34232 NULL ccccc
34020 34020 kkkkkk
34020 34020 looo
Am I doing correct here ? Also MY SQL SERVER is not allowing keywords LFET RIGHT when used for joins
(An expression of non-boolean type specified in a context where a condition is expected, near 'LEFT')