Welcome to SPN

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

Sign Up Now!

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
     

Share This Page