Compare identical table structures for different values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ago
    New Member
    • Jun 2007
    • 7

    #1

    Compare identical table structures for different values

    Hi,

    Is there any way to compare two identical table structures in access for different values in them.
    EG:
    Table 1:
    Name occupation
    rob plumber

    Table 2:
    Name occupation
    rob builder

    Is there any way this can be done in a query ?
    Also how can a select query be written in vba for say table one in the above example?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by ago
    Hi,

    Is there any way to compare two identical table structures in access for different values in them.
    EG:
    Table 1:
    Name occupation
    rob plumber

    Table 2:
    Name occupation
    rob builder

    Is there any way this can be done in a query ?
    Also how can a select query be written in vba for say table one in the above example?
    The following SQL Statement will return the Name, Occupation in Table 1, and all Occupations in Table 2 that do not match the Occupation in Table 1 for the same individual. Is this what you want?
    [CODE=sql]SELECT [Table 1].Name, [Table 1].Occupation, [Table 2].Occupation
    FROM [Table 1] INNER JOIN [Table 2] ON [Table 1].Name = [Table 2].Name
    WHERE [Table 2].Occupation<>[Table 1].[Occupation];[/CODE]

    Comment

    • ago
      New Member
      • Jun 2007
      • 7

      #3
      Compare identical table structures for different values

      Originally posted by ADezii
      The following SQL Statement will return the Name, Occupation in Table 1, and all Occupations in Table 2 that do not match the Occupation in Table 1 for the same individual. Is this what you want?
      [CODE=sql]SELECT [Table 1].Name, [Table 1].Occupation, [Table 2].Occupation
      FROM [Table 1] INNER JOIN [Table 2] ON [Table 1].Name = [Table 2].Name
      WHERE [Table 2].Occupation<>[Table 1].[Occupation];[/CODE]
      Yes. This does work fine. Just to add to it if I use <>Nz it will also compare the fields that are null right ?
      Last edited by missinglinq; Jul 26 '07, 01:22 AM. Reason: Clarifying Subject Matter

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        I've changed the title of your post to make the subject matter clearer to members on the forum now, as well as people who may use the Search function in the future researching similar problems. Since you are a new member of the forum, please take the time to read the Posting Guidelines, paying particular attention to the section "Give a clear title to your question."

        (POSTING GUIDELINES: Please read carefully before posting to a forum)

        Welcome to TheScripts!

        Linq ;0)>

        Comment

        Working...