Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Comparing 2 fields

Discussion in 'Information Technology' started by ibeetb, Jul 28, 2006.

  1. ibeetb

    ibeetb
    Expand Collapse
    Guest

    I want to write a query where two tables are joined on a common field and
    then I want to compare, line by line, the differences in the fields that
    make up each record. Example, they are joined on Project Number and then
    compare where the PO number is different for the same project number from
    both tables.....

    Any help?
     
  2. Loading...


  3. OP
    Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    What exactly are you looking for: details of which rows aren't identical?

    Join the two tables in the normal manner, and drag all of the fields from
    Table 1 in the grid.

    Ignore the Id field.

    Under Field1, put <> [Table2].[Field1] for the criteria.

    Under Field2, put <> [Table2].[FIeld2] ON A SEPARATE LINE for the criteria.

    Repeat for all of the remaining fields, PUTTING EACH CRITERIA ON A SEPARATE
    LINE IN THE GRID.

    If you go into the SQL View of the query, you should see something like:

    SELECT Table1.Id, Table1.Field1, Table1.Field2, Table1.Field3
    FROM Table1 INNER JOIN Table2
    ON Table1.Id = Table2.Id
    WHERE Table1.Field1 <> Table2.Field1
    OR Table1.Field2 <> Table2.Field2
    OR Table1.Field3 <> Table2.Field3

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "ibeetb" <tb20169@aol.com> wrote in message
    news:%234pYknyjGHA.1508@TK2MSFTNGP04.phx.gbl...
    >I want to write a query where two tables are joined on a common field and
    >then I want to compare, line by line, the differences in the fields that
    >make up each record. Example, they are joined on Project Number and then
    >compare where the PO number is different for the same project number from
    >both tables.....
    >
    > Any help?
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page