Results 1 to 4 of 4
  1. #1
    Kivan is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    27

    Distinct query?

    Hi,

    I have 3 tables. People, Projects and Metrics. Table metrics holds IDs from People and Projects.
    I'm trying to make a query. In this query I would like to see all of the people who are not assigned to the particular project. For example, I have a project with ID number 3. I also have 4 people in database. Person with ID number 1 and number 4 is assigned to project with ID 3. Now I want my query to show all of the people who are not assigned to the project number 3. So it should show two people with ID 2 and 3, and for those records IDmetrics does not exist. I've attached a sample of this database.

    Thanks for your time.
    Attached Files Attached Files

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Check out if below gives some guidelines :
    Code:
    SELECT tblPeople.IDpeople, tblPeople.PP
    FROM tblPeople 
    WHERE 
    IDpeople 
    NOT IN 
    (
    SELECT tlbMetrics.IDPeople
    FROM tlbMetrics
    WHERE (((tlbMetrics.IDProjects)=3))
    )
    Thanks

  3. #3
    Kivan is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    27
    Yes it works! I only changed

    WHERE (((tlbMetrics.IDProjects)=3))

    Into this

    WHERE (((tlbMetrics.IDProjects)=[TempVars]![test]))

    To be able to set value as I want. Now I need to move it to real project which is a lot more copmlicated, but the idea is good. I will mark this tread as solved when it will be done. Thanks for your help .

    Edit: Everything works great. Thanks again !

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Glad you found it helpful.

    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query for distinct member number
    By Lauri in forum Queries
    Replies: 1
    Last Post: 08-23-2013, 03:22 AM
  2. distinct query
    By slimjen in forum Queries
    Replies: 4
    Last Post: 05-25-2012, 08:30 AM
  3. distinct query
    By slimjen in forum Queries
    Replies: 3
    Last Post: 02-04-2012, 04:44 PM
  4. Distinct count in a query
    By Fabdav in forum Access
    Replies: 5
    Last Post: 09-14-2011, 04:53 PM
  5. DISTINCT on a Union All query?
    By Robeen in forum Queries
    Replies: 3
    Last Post: 04-27-2011, 10:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums