RoccoMaxamas
RoccoMaxamas

Reputation: 349

"Find Unmatched" Query -- Using Queries instead of Tables

I'm using Access 2010.

I have a database with multiple tables, each containing different components of teaching data.

Ultimately, I'd like to find "people who will be teaching a course in the upcoming semester and who have never taught before."

Currently, I am doing this through a series of steps:

  1. Creating one table (through a query) that has a list of everyone who is teaching in the upcoming semester and what they are teaching (this data comes from multiple tables). (tbl_NewInstructors)
  2. Creating another table (through a query) that has a list of everyone who has ever taught (but not including this upcoming semester). (tbl_NewInstructors2)
  3. Running this select statement:

    SELECT tbl_NewInstructors.Name, tbl_NewInstructors.Course 
    
    FROM tbl_NewInstructors
    
    WHERE (((Exists (SELECT * from tbl_NewInstructors2 
    
    WHERE tbl_NewInstructors2.Name = tbl_NewInstructors.Name))=False));
    
  4. Getting my list!

The main issue is that I have to create two tables each time I want to run this, and I would RATHER just run a query of my two current select queries, than a query on tables that I create through those queries. Unfortunately, when I try to run a query on the queries, it doesn't work.

Any suggestions?

Upvotes: 1

Views: 1388

Answers (1)

Sam Goldberg
Sam Goldberg

Reputation: 6801

I'm not sure if you tried this, but in Access when you save a query, it acts like a table (really a "view") which you can then query using another query. To keep it simple, just save each of the 2 queries you created in Step 1 and Step 2, and then run your query from Step 3, substituting the name of each of your saved queries for tbl_NewInstructors and tbl_NewInstructors2. (And of course, you can save your query from Step 3, and just run that whenever you want this report).

Most likely, you could create a single SQL to do this, but I think saving the queries will be simpler, and will reuse what you already know how to do.

Upvotes: 1

Related Questions