Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unmatched query just doesn't work

Status
Not open for further replies.

catbert

Technical User
May 1, 2003
56
GB
Ok, this is driving me nuts. I'm in Access 97, I have tried using the unmatched query wizard and writing this from scratch and I get the same result:

I have two tables
Table 1 = list of all open business
Table 2 = all business which are being inspected

Each business has a unique identifier, and I want a list of anyway we haven't inspected. Simple then, compare tables and pull out in 1 but not in 2. Trouble is whichever way I set the join, or run the unmatched query wizard ( and yes I know which way it should be) it always always returns all the business which appear in both tables. I came across a similar issue yesterday and in the end wrote two MORE queries pulling out just the business ID from each query. THEN ran the query wizard and it worked perfectly. Trouble is I'm sure I shouldn't have to

Can ANYONE explain what's going on before I go insane

Thanks!
 
Hi, tablenames and fields are probably different but...
Code:
SELECT t1.BUSINESS_ID, t2.BUSINESS_ID
FROM BUSINESS1 AS t1 LEFT JOIN BUSINESS2 AS t2
    ON t1.BUSINESS_ID = t2.BUSINESS_ID
    GROUP BY t1.BUSINESS_ID, t2.BUSINESS_ID
    HAVING t2.BUSINESS_ID Is Null;
will show business id in table business1 that are not in table business2.

Why have seperate tables rather than having them all on one table and flag those that have been inspected? HTH, Jamie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top