Hello,
I have create some crosstab querys and basically now i have an issue , i am not sure if its a "logical" issue.
First of all here is the SQL :
The query is working fine but the problem i think its on the joins.
I want the query to show me all employeenames that are assigned to the table AnnualTypes (basically there is employeeid but they have a relationship) even if they are not assigned to any LeaveType.Leave Type.
I have made a combination of querys as i have 5 tables and the joins are getting to complex but i still cant figure it out .
But , again , i am not sure if its the join or something else .
Here is a screenshot of my tables and relations:
I have create some crosstab querys and basically now i have an issue , i am not sure if its a "logical" issue.
First of all here is the SQL :
Code:
TRANSFORM
Nz(Sum(Duration),0) AS SumOfDuration
SELECT
Employee.EmployeeName,
AnnualLeave.Licenses
FROM Season
INNER JOIN (LeaveType
INNER JOIN ((Employee INNER JOIN Main
ON Employee.EmployeeID = Main.EmployeeID)
INNER JOIN AnnualLeave
ON Employee.EmployeeID =
AnnualLeave.EmployeeID)
ON LeaveType.LeaveID = Main.LeaveID)
ON (Season.SeasonID = Main.SeasonID)
AND (Season.SeasonID = AnnualLeave.SeasonID)
WHERE (((AnnualLeave.SeasonID)=2
Or (AnnualLeave.SeasonID) Is Null))
GROUP BY Employee.EmployeeName,
AnnualLeave.Licenses
PIVOT LeaveType.LeaveType In
("Annual", "Personal", "Sick", "Bonus");
I want the query to show me all employeenames that are assigned to the table AnnualTypes (basically there is employeeid but they have a relationship) even if they are not assigned to any LeaveType.Leave Type.
I have made a combination of querys as i have 5 tables and the joins are getting to complex but i still cant figure it out .
But , again , i am not sure if its the join or something else .
Here is a screenshot of my tables and relations:
Comment