Results 1 to 4 of 4
  1. #1
    jobbie is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2014
    Posts
    46

    SELECT query to not include record if already exists in another table

    I have 2 tables:



    Query_Rates (Actually this is the result of a query):


    Unit R_Date Sold_Rate
    A 24-AUG-15 145
    B 21-AUG-15 133
    X 25-AUG-15 200









    Sent till date:

    Unit R_Date Sold rate
    A 24-AUG-15 142
    A 24-AUG-15 145
    X 25-AUG-15 190








    When I run the query:

    Code:
    SELECT Query_Rates.*
    FROM Query_Rates LEFT JOIN [Sent till date] ON (Query_Rates.R_Date = [Sent till date].[R_date]) AND (Query_Rates.Unit = [Sent till date].Unit)WHERE abs([Sent till date].[Sold rate]-[Query_Rates].[Sold_Rate])>1

    I get the following result:


    Unit R_Date Sold_Rate
    A 24-AUG-15 145
    X 25-AUG-15 200






    So what I want is a list of all the records from the Query_Rates table where the absolute differences between the sold rates between Query_Rates & [Sent till date] (matching the unit # and the dates) is greater than 1 and the record shouldn't be displayed if it is already present in the [Sent till date] table. But if you notice the first record which has unit A is already mentioned in the "Sent till date" table and shouldn't be repeated again in the query result.

    The desired out put should be:

    Unit R_Date Sold_Rate
    X 25-AUG-15 200

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,728
    Please show us your table designs(fields and data types), and a clear statement of what your final output should be using some examples from your data.

  3. #3
    jobbie is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2014
    Posts
    46
    Quote Originally Posted by orange View Post
    Please show us your table designs(fields and data types), and a clear statement of what your final output should be using some examples from your data.
    Sorry I had made a mistake in posting the sample tables. I have edited my post. I would appreciate it if you could check it again... Thanks

  4. #4
    jobbie is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2014
    Posts
    46
    Quote Originally Posted by orange View Post
    Please show us your table designs(fields and data types), and a clear statement of what your final output should be using some examples from your data.
    Hi can you please help me?

    Thanks

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

Similar Threads

  1. Replies: 1
    Last Post: 08-09-2015, 10:03 AM
  2. Replies: 32
    Last Post: 05-23-2013, 04:16 PM
  3. Replies: 3
    Last Post: 01-24-2013, 08:16 PM
  4. Testing if a record exists on a Table
    By axess_nab in forum Queries
    Replies: 2
    Last Post: 06-14-2011, 12:27 PM
  5. How to test of record exists in table?
    By tdaccess in forum Access
    Replies: 3
    Last Post: 04-13-2011, 10:22 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