Welcome to SPN

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

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

Compare two table fields.

Discussion in 'Information Technology' started by JLD, Nov 1, 2005.

  1. JLD

    JLD
    Expand Collapse
    Guest

    I have two tables.

    Table one with: Property id, property address, year, and other info.
    Table two with: Property id, owner name, owner address.

    I want to compare property id's and give a return only if the owner address
    and property addres does not match.

    Thanks sooo much.

    JLD
     
  2. Loading...


  3. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    SELECT TableOne.PropertyID, TableOne.PropertyAddress, TableOne.[Year],
    TableTwo_OwnerName FROM TableOne INNER JOIN TableTwo ON (TableOne.PropertyID
    = TableTwo.PropertyID AND TableOne.PropertyAddress <> TableTwo_OwnerAddress)

    You'll need to switch to SQL view to do this - you can't create a
    'non-equi-join' query like this using the graphical query designer.

    --
    Brendan Reynolds


    "JLD" <JLD@discussions.microsoft.com> wrote in message
    news:F06E3F2E-8565-4F62-A9A1-4F87416E1B9F@microsoft.com...
    >I have two tables.
    >
    > Table one with: Property id, property address, year, and other info.
    > Table two with: Property id, owner name, owner address.
    >
    > I want to compare property id's and give a return only if the owner
    > address
    > and property addres does not match.
    >
    > Thanks sooo much.
    >
    > JLD
     
  4. Ofer

    Ofer
    Expand Collapse
    Guest

    Try this
    SELECT TableName1.*
    FROM TableName2 INNER JOIN TableName1 ON TableName2.[Property id]=
    TableName1.[Property id]
    WHERE TableName1.[property address])<>[TableName2].[owner address]))
    --
    If I answered your question, please mark it as an answer. That way, it will
    stay saved for a longer time, so other can benifit from it.

    Good luck



    "JLD" wrote:

    > I have two tables.
    >
    > Table one with: Property id, property address, year, and other info.
    > Table two with: Property id, owner name, owner address.
    >
    > I want to compare property id's and give a return only if the owner address
    > and property addres does not match.
    >
    > Thanks sooo much.
    >
    > JLD
     
  5. Ofer

    Ofer
    Expand Collapse
    Guest

    Sorry, I missed some brackets

    SELECT TableName1.*
    FROM TableName2 INNER JOIN TableName1 ON TableName2.[Property id]=
    TableName1.[Property id]
    WHERE TableName1.[property address]<>[TableName2].[owner address]

    --
    If I answered your question, please mark it as an answer. That way, it will
    stay saved for a longer time, so other can benifit from it.

    Good luck



    "Ofer" wrote:

    > Try this
    > SELECT TableName1.*
    > FROM TableName2 INNER JOIN TableName1 ON TableName2.[Property id]=
    > TableName1.[Property id]
    > WHERE TableName1.[property address])<>[TableName2].[owner address]))
    > --
    > If I answered your question, please mark it as an answer. That way, it will
    > stay saved for a longer time, so other can benifit from it.
    >
    > Good luck
    >
    >
    >
    > "JLD" wrote:
    >
    > > I have two tables.
    > >
    > > Table one with: Property id, property address, year, and other info.
    > > Table two with: Property id, owner name, owner address.
    > >
    > > I want to compare property id's and give a return only if the owner address
    > > and property addres does not match.
    > >
    > > Thanks sooo much.
    > >
    > > JLD
     
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