Why are these 2 FROM statements not the same?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Below are two From statements and i don't understand Access's use of
parenthesis. I typically don't even use them when making my statements but
Access requires them and i dont' understand them.

Thanks!

SELECT Employee.EmployeeID, Sum(SickTime.SickTime) AS SickTime,
Sum(VacationTime.VacationTime) AS VacationTime,
Sum(PersonalTime.PersonalTime) AS PersonalTime

FROM ((((Department INNER JOIN ON Department.DepartmentID =
Employee.DepartmentID) Center INNER JOIN Employee ON Center.CenterID =
Employee.CenterID) LEFT
JOIN PersonalTime ON Employee.EmployeeID = PersonalTime.EmployeeID) LEFT
JOIN SickTime ON Employee.EmployeeID = SickTime.EmployeeID) LEFT JOIN
VacationTime ON Employee.EmployeeID = VacationTime.EmployeeID

WHERE (((Department.DepartmentID)=1))
GROUP BY Employee.EmployeeID;

------------
SELECT Employee.EmployeeID, Sum(SickTime.SickTime) AS SickTime,
Sum(VacationTime.VacationTime) AS VacationTime,
Sum(PersonalTime.PersonalTime) AS personaltime

FROM (((Department INNER JOIN (Center INNER JOIN Employee ON Center.CenterID
= Employee.CenterID) ON Department.DepartmentID = Employee.DepartmentID) LEFT
JOIN PersonalTime ON Employee.EmployeeID = PersonalTime.EmployeeID) LEFT JOIN
SickTime ON Employee.EmployeeID = SickTime.EmployeeID) LEFT JOIN VacationTime
ON Employee.EmployeeID = VacationTime.EmployeeID

WHERE (((Department.DepartmentID)=1))
GROUP BY Employee.EmployeeID;
 
jacob said:
Below are two From statements and i don't understand Access's use of
parenthesis. I typically don't even use them when making my statements but
Access requires them and i dont' understand them.

SELECT Employee.EmployeeID, Sum(SickTime.SickTime) AS SickTime,
Sum(VacationTime.VacationTime) AS VacationTime,
Sum(PersonalTime.PersonalTime) AS PersonalTime

FROM ((((Department INNER JOIN ON Department.DepartmentID =
Employee.DepartmentID) Center INNER JOIN Employee ON Center.CenterID =
Employee.CenterID) LEFT
JOIN PersonalTime ON Employee.EmployeeID = PersonalTime.EmployeeID) LEFT
JOIN SickTime ON Employee.EmployeeID = SickTime.EmployeeID) LEFT JOIN
VacationTime ON Employee.EmployeeID = VacationTime.EmployeeID

WHERE (((Department.DepartmentID)=1))
GROUP BY Employee.EmployeeID;

------------
SELECT Employee.EmployeeID, Sum(SickTime.SickTime) AS SickTime,
Sum(VacationTime.VacationTime) AS VacationTime,
Sum(PersonalTime.PersonalTime) AS personaltime

FROM (((Department INNER JOIN (Center INNER JOIN Employee ON Center.CenterID
= Employee.CenterID) ON Department.DepartmentID = Employee.DepartmentID) LEFT
JOIN PersonalTime ON Employee.EmployeeID = PersonalTime.EmployeeID) LEFT JOIN
SickTime ON Employee.EmployeeID = SickTime.EmployeeID) LEFT JOIN VacationTime
ON Employee.EmployeeID = VacationTime.EmployeeID

WHERE (((Department.DepartmentID)=1))
GROUP BY Employee.EmployeeID;


The first one is missing a INNER JOIN before the Center
table.

Note that the parenthesis are just used to specify the order
that the joins are done. This is much like using
parenthesis to specify the order of calculations on an
arithmetic expression.
 
Back
Top