mdProgrammer
Programmer
I have a query that I'm trying to create for Access, with limited success (data's not always correct, and can be very slow). Anyway, the query works in a similar way to this (only I was trying to change the Having clause to count if the item didn't say "close", and ignore those IDs):
Here's what the query is supposed to do -
1. For each UserID, find only records where ALL items are closed (anything other than close, ignore).
2. From another table, get the statuses that are open.
This is a watered down example of the actual query, which contains 7 tables. My first attempt was using subqueries (selecting rows from the table containing items, then matching with auths. 2nd attempt was to have a query that creates a temporary table, and require the user running this query to run two queries. This may confuse them eventually...), which promptly caused Access to lock up. The record ID that should display in this example is ID 1.
Here's what the query is supposed to do -
1. For each UserID, find only records where ALL items are closed (anything other than close, ignore).
2. From another table, get the statuses that are open.
This is a watered down example of the actual query, which contains 7 tables. My first attempt was using subqueries (selecting rows from the table containing items, then matching with auths. 2nd attempt was to have a query that creates a temporary table, and require the user running this query to run two queries. This may confuse them eventually...), which promptly caused Access to lock up. The record ID that should display in this example is ID 1.
Code:
Name_ID Item_Status Auth_Status
1 Closed Open
1 Closed Closed
2 Closed Closed
2 Closed Closed
2 Closed Closed
3 Closed Open
3 Open Closed
4 Open Open
4 Open Open