Forum Discussion
Multi table query
Hello,
I have created a logbook to record closed and pended issues in the departments and created different tables for each department. I want to know all the pending issues from all the departments. How to create a query for the same. Kindly help.
- George HepworthSteel Contributor
You have a much more serious design problem in that each department is in a separate table. Unfortunately, queries become significantly more complex when you do that.
You COULD, as a work around, create a UNION query that includes each of the currently existing tables. That would have to be modified from time to time to accommodate changes in departments, though.I strongly urge you to correct this design problem now, rather than continue to invest extra work and complicated queries and code to compensate.
Merge all of them into ONE table, similar to the current one shown in your screen shot, with an additional FIELD in that table to indicate which department that record applies to.
- sundarzeeCopper Contributor
- George HepworthSteel ContributorYou perform tasks like this with queries. Parameterized queries, to be precise.
In this case, since we can't see anything in the screen shot called "departments" my best guess for this query in this case would include something like this:
SELECT ID, [RFI NO], RECEIVED, TARGET, RESPONDED, STATUS, COMMENTS, [CCBA RESPO]
FROM [RFI/AD3/CIVIL]
WHERE STATUS = "PENDING"
On a related note, your table and field names reflect some less than desirable naming choices. We try NOT to incorporate spaces and non-standard characters like the / in names. They can, and often do, create complications. It's better to avoid them.