Frank Freese
asked on
Help with WHERE in SQL statement
Experts,
I would like to evalute after AS Store a Where statement that says only include from tblDesignatedEmployee.Empl oyeeTypeID =1
I continue this pattern at AS District a Where statement that says only include from tblDesignatedEmployee.Empl ooyeeTypeI D=2
I continue this pattern at AS Support Where statement that says only include from tblDesignatedEmployee.Empl oyeeTypeID =3
I continue this pattern at AS StoreMgr Where statement that says only include from tblDesignatedEmployee.Empl oyeeTypeID =4
In other words I want to include only District Managers if the tblDesignatedEmployee.Empl oyeeTypeID = 1
Include only Support in the tblDesignatedEmployee.Empl oyeeTypeID =2
Include only StoreMgr in the tblDesignatedEmployee.Empl oyeeTypeID =3
Include only AsstStorMgr in the tblDesignatedEmployee.Empl oyeeTypeID =4
SELECT tblStore.StoreNumberID, "Store #" & " " & tblStore.StoreNumber & " " & tblStore.StoreName & " " & tblStates.State AS Store, tblEmployee.EmployeeFirstN ame & " " & tblEmployee.EmployeeLastNa me AS District, tblEmployee_1.EmployeeFirs tName & " " & tblEmployee_1.EmployeeLast Name AS Support, tblEmployee_2.EmployeeFirs tName & " " & tblEmployee_2.EmployeeLast Name AS StoreMgr, tblEmployee_3.EmployeeFirs tName & " " & tblEmployee_3.EmployeeLast Name AS AsstStoreMgr
FROM tblStates INNER JOIN (tblStore INNER JOIN (tblEmployee AS tblEmployee_3 INNER JOIN (tblEmployee AS tblEmployee_2 INNER JOIN (tblEmployee AS tblEmployee_1 INNER JOIN (tblEmployee INNER JOIN tblDesignatedEmployee ON tblEmployee.EmployeeID = tblDesignatedEmployee.Empl oyeeID) ON tblEmployee_1.EmployeeID = tblDesignatedEmployee.Empl oyeeID) ON tblEmployee_2.EmployeeID = tblDesignatedEmployee.Empl oyeeID) ON tblEmployee_3.EmployeeID = tblDesignatedEmployee.Empl oyeeID) ON tblStore.StoreNumberID = tblDesignatedEmployee.Stor eID) ON tblStates.StateID = tblStore.StateID
ORDER BY tblStore.StoreNumber;
I would like to evalute after AS Store a Where statement that says only include from tblDesignatedEmployee.Empl
I continue this pattern at AS District a Where statement that says only include from tblDesignatedEmployee.Empl
I continue this pattern at AS Support Where statement that says only include from tblDesignatedEmployee.Empl
I continue this pattern at AS StoreMgr Where statement that says only include from tblDesignatedEmployee.Empl
In other words I want to include only District Managers if the tblDesignatedEmployee.Empl
Include only Support in the tblDesignatedEmployee.Empl
Include only StoreMgr in the tblDesignatedEmployee.Empl
Include only AsstStorMgr in the tblDesignatedEmployee.Empl
SELECT tblStore.StoreNumberID, "Store #" & " " & tblStore.StoreNumber & " " & tblStore.StoreName & " " & tblStates.State AS Store, tblEmployee.EmployeeFirstN
FROM tblStates INNER JOIN (tblStore INNER JOIN (tblEmployee AS tblEmployee_3 INNER JOIN (tblEmployee AS tblEmployee_2 INNER JOIN (tblEmployee AS tblEmployee_1 INNER JOIN (tblEmployee INNER JOIN tblDesignatedEmployee ON tblEmployee.EmployeeID = tblDesignatedEmployee.Empl
ORDER BY tblStore.StoreNumber;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
Hope this helps,
Daniel