Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. MS-Access finding unmatched records

MS-Access finding unmatched records

Scheduled Pinned Locked Moved Database
databasedesignquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BennyCriziko
    wrote on last edited by
    #1

    I have two tables in MS-Access "tmpChanges" (685 records) and "tmpChangesWithDates" (785 records). I want to design a query that will only show those 100 records that are the difference between the two tables. Each has 4 fields and are common to both tables: State, City, Sale, SaleDate. The table "tmpChanges" has no value listed in the SaleDate field. I tried this and it did not work, any clues?: SELECT tmpChangesWithDates.City, tmpChangesWithDates.State, tmpChangesWithDates.Sale, tmpChangesWithDates.SaleDate FROM tmpChangesWithDates LEFT JOIN tmpChanges ON tmpChangesWithDates.[Sale] = tmpChanges.[Sale] WHERE (((tmpChanges.SaleDate) Is Null));

    L C 2 Replies Last reply
    0
    • B BennyCriziko

      I have two tables in MS-Access "tmpChanges" (685 records) and "tmpChangesWithDates" (785 records). I want to design a query that will only show those 100 records that are the difference between the two tables. Each has 4 fields and are common to both tables: State, City, Sale, SaleDate. The table "tmpChanges" has no value listed in the SaleDate field. I tried this and it did not work, any clues?: SELECT tmpChangesWithDates.City, tmpChangesWithDates.State, tmpChangesWithDates.Sale, tmpChangesWithDates.SaleDate FROM tmpChangesWithDates LEFT JOIN tmpChanges ON tmpChangesWithDates.[Sale] = tmpChanges.[Sale] WHERE (((tmpChanges.SaleDate) Is Null));

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      BennyCriziko wrote:

      any clues

      You got the wrong join if you're looking for differences. I'd do it with a "WHERE NOT IN" and a subquery.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      B 1 Reply Last reply
      0
      • L Lost User

        BennyCriziko wrote:

        any clues

        You got the wrong join if you're looking for differences. I'd do it with a "WHERE NOT IN" and a subquery.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        B Offline
        B Offline
        BennyCriziko
        wrote on last edited by
        #3

        Like this?: SELECT tmpChangesWithDates.City, tmpChangesWithDates.State, tmpChangesWithDates.Sale, tmpChangesWithDates.SaleDate FROM tmpChangesWithDates WHERE NOT IN (SELECT tmpChangesWithDates.City, tmpChangesWithDates.State, tmpChangesWithDates.Sale, tmpChangesWithDates.SaleDate FROM tmpChangesWithDates LEFT JOIN tmpChanges ON tmpChangesWithDates.[Sale] = tmpChanges.[Sale] WHERE (((tmpChanges.SaleDate) Is Null)));

        L 1 Reply Last reply
        0
        • B BennyCriziko

          I have two tables in MS-Access "tmpChanges" (685 records) and "tmpChangesWithDates" (785 records). I want to design a query that will only show those 100 records that are the difference between the two tables. Each has 4 fields and are common to both tables: State, City, Sale, SaleDate. The table "tmpChanges" has no value listed in the SaleDate field. I tried this and it did not work, any clues?: SELECT tmpChangesWithDates.City, tmpChangesWithDates.State, tmpChangesWithDates.Sale, tmpChangesWithDates.SaleDate FROM tmpChangesWithDates LEFT JOIN tmpChanges ON tmpChangesWithDates.[Sale] = tmpChanges.[Sale] WHERE (((tmpChanges.SaleDate) Is Null));

          C Offline
          C Offline
          Chris Quinn
          wrote on last edited by
          #4

          SELECT tmpChangesWithDates.City, tmpChangesWithDates.State, tmpChangesWithDates.Sale, tmpChangesWithDates.SaleDate FROM tmpChangesWithDates LEFT OUTER JOIN tmpChanges ON tmpChangesWithDates.[Sale] = tmpChanges.[Sale] WHERE (((tmpChanges.SaleDate) Is Null));

          ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

          1 Reply Last reply
          0
          • B BennyCriziko

            Like this?: SELECT tmpChangesWithDates.City, tmpChangesWithDates.State, tmpChangesWithDates.Sale, tmpChangesWithDates.SaleDate FROM tmpChangesWithDates WHERE NOT IN (SELECT tmpChangesWithDates.City, tmpChangesWithDates.State, tmpChangesWithDates.Sale, tmpChangesWithDates.SaleDate FROM tmpChangesWithDates LEFT JOIN tmpChanges ON tmpChangesWithDates.[Sale] = tmpChanges.[Sale] WHERE (((tmpChanges.SaleDate) Is Null)));

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            If the result is correct, then yes :-\

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups