Link to home
Start Free TrialLog in
Avatar of Frank Freese
Frank FreeseFlag for United States of America

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.EmployeeTypeID=1
I continue this pattern at AS District a Where statement that says only include from tblDesignatedEmployee.EmplooyeeTypeID=2
I continue this pattern at AS Support Where statement that says only include from tblDesignatedEmployee.EmployeeTypeID=3
I continue this pattern at AS StoreMgr Where statement that says only include from tblDesignatedEmployee.EmployeeTypeID=4

In other words I want to include only District Managers if the tblDesignatedEmployee.EmployeeTypeID = 1
Include only Support in the tblDesignatedEmployee.EmployeeTypeID=2
Include only StoreMgr in the tblDesignatedEmployee.EmployeeTypeID=3
Include only AsstStorMgr in the tblDesignatedEmployee.EmployeeTypeID=4


SELECT tblStore.StoreNumberID, "Store #" & " " & tblStore.StoreNumber & " " & tblStore.StoreName & " " & tblStates.State AS Store, tblEmployee.EmployeeFirstName & " " & tblEmployee.EmployeeLastName AS District, tblEmployee_1.EmployeeFirstName & " " & tblEmployee_1.EmployeeLastName AS Support, tblEmployee_2.EmployeeFirstName & " " & tblEmployee_2.EmployeeLastName AS StoreMgr, tblEmployee_3.EmployeeFirstName & " " & tblEmployee_3.EmployeeLastName 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.EmployeeID) ON tblEmployee_1.EmployeeID = tblDesignatedEmployee.EmployeeID) ON tblEmployee_2.EmployeeID = tblDesignatedEmployee.EmployeeID) ON tblEmployee_3.EmployeeID = tblDesignatedEmployee.EmployeeID) ON tblStore.StoreNumberID = tblDesignatedEmployee.StoreID) ON tblStates.StateID = tblStore.StateID
ORDER BY tblStore.StoreNumber;
Avatar of danishani
danishani
Flag of United States of America image

In your query, you add the fields where you want to set your criteria. You dont have to Show them, the uncheck the Show checkbox.

 User generated image
Hope this helps,
Daniel
ASKER CERTIFIED SOLUTION
Avatar of kmslogic
kmslogic
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Frank Freese

ASKER

thank you