[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 451
  • Last Modified:

Help with WHERE in SQL statement

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;
Frank Freese
Frank Freese
1 Solution
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.

Hope this helps,
You'll need to create separate queries for each of your WHERE conditions and then join them together on some common ID.
Frank FreeseAuthor Commented:
thank you

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now