Results 1 to 7 of 7
  1. #1
    Chris762 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    4

    Access Comparitive Query

    Hi All,



    I have two sets of data I want to compare.

    In one set I have a reference number, such as 000750 and a state, such as AZ.
    I have another table with similar repeating records.

    What I need to do is compare the two tables by matching number with number and making sure the states are identical.

    For example if I have the following

    Table 1
    000750 AZ
    000750 MI
    000751 AZ
    000751 AZ

    Table 2
    000750 MI
    000750 MI
    000751 AZ
    000751 AZ

    I would need it to identify that 000750 has different states in the two sheets

    Thanks for the Help!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Have you tried the Find Unmatched query wizard?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Chris762 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    4
    I have, It is simply identifying that one record 000749 for example is in one table and not the other. I need it to compare the states for each number and if they are the same move on and if different identify that in the query results

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    You need to compare the combined value of number and state but only if the number is in both tables?

    Show the sql statement you attempted. Try this:

    SELECT Table1.Number, Table1.State
    FROM Table2 RIGHT JOIN Table1 ON (Table2.Number = Table1.Number) AND (Table2.State = Table1.State)
    WHERE (((Table2.State) Is Null))
    GROUP BY Table1.Number, Table1.State
    HAVING Table1.Number IN (SELECT Number FROM Table2);

    The wizard wasn't much help on this one after all.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Chris762 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    4
    I just tried to use the unmatched query. The same numbers are in both tables but some are repeated. I just need to ensure the states are the same for each number.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    I was editing my previous post while you were posting yours. Review it again.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Chris762 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    4
    Allright thanks, I will give this a try tommorow! I'll post back and let you know.

    Thanks!

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

Similar Threads

  1. Replies: 3
    Last Post: 04-24-2012, 08:32 AM
  2. Replies: 34
    Last Post: 02-15-2012, 05:17 AM
  3. Replies: 12
    Last Post: 05-22-2011, 03:49 PM
  4. Convert Access query to SQL Server query
    By mkallover in forum Queries
    Replies: 2
    Last Post: 05-13-2011, 06:20 AM
  5. Replies: 10
    Last Post: 02-02-2011, 05:48 PM

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