Hi All,
I have 3 tables,
Employee:
Id, code, name, pos_def_id
213, Z300, Diana Benk, 108
ShiftAssigment:
Id, shiftId, EmployeeID, date, assigmentReason_def_id
180, 3, 213, 2011-09-23, 198
Definition:
Id, DefinitionCategoryID, description
108, 2, Full Time
198, 1, Medical
You can see employee Diana ID 213 is full time(108) and has been assigned shift 3 which is a medical(198) shift type.
The sql i have written shows the employee details and shift but not the full time or part time as the case maybe. I need to reference the definition table for each shift assigned and for each employee.
Current SQL:
SELECT Sh.Description, Sh.LocationID, Sh.StartTime, sh.Duration,
sa.ShiftID, sa.EmployeeID, sa.Date,
E.Code AS EmpCode, E.Name, E.IsActive,
D.DefinitionCategoryID,AssignmentReason_DefID, D.Description AS [Hearing Type],
E.Position_DefID, D.Description AS [Shift Type]
FROM
ShiftAssignment sa
INNER JOIN
Definition d ON D.ID = sa.AssignmentReason_DefID
INNER JOIN
Shift sh ON Sh.ID = sa.ShiftID
INNER JOIN
Employee e ON E.ID = sa.EmployeeID
Current Results:
Description LocationID StartTime Duration ShiftID EmployeeID Date EmpCode Name IsActive DefinitionCategoryID AssignmentReason_DefID Hearing Type Position_DefID Shift Type
NSW HR1 AM 52 00:00.0 210 3 213 00:00.0 Z300 Diana Benk 1 1 198 Show Cause 108 Show Cause
I need the last column to be full time not show cuase.
Thanks
I have 3 tables,
Employee:
Id, code, name, pos_def_id
213, Z300, Diana Benk, 108
ShiftAssigment:
Id, shiftId, EmployeeID, date, assigmentReason_def_id
180, 3, 213, 2011-09-23, 198
Definition:
Id, DefinitionCategoryID, description
108, 2, Full Time
198, 1, Medical
You can see employee Diana ID 213 is full time(108) and has been assigned shift 3 which is a medical(198) shift type.
The sql i have written shows the employee details and shift but not the full time or part time as the case maybe. I need to reference the definition table for each shift assigned and for each employee.
Current SQL:
SELECT Sh.Description, Sh.LocationID, Sh.StartTime, sh.Duration,
sa.ShiftID, sa.EmployeeID, sa.Date,
E.Code AS EmpCode, E.Name, E.IsActive,
D.DefinitionCategoryID,AssignmentReason_DefID, D.Description AS [Hearing Type],
E.Position_DefID, D.Description AS [Shift Type]
FROM
ShiftAssignment sa
INNER JOIN
Definition d ON D.ID = sa.AssignmentReason_DefID
INNER JOIN
Shift sh ON Sh.ID = sa.ShiftID
INNER JOIN
Employee e ON E.ID = sa.EmployeeID
Current Results:
Description LocationID StartTime Duration ShiftID EmployeeID Date EmpCode Name IsActive DefinitionCategoryID AssignmentReason_DefID Hearing Type Position_DefID Shift Type
NSW HR1 AM 52 00:00.0 210 3 213 00:00.0 Z300 Diana Benk 1 1 198 Show Cause 108 Show Cause
I need the last column to be full time not show cuase.
Thanks