Compare two table fields.

  • Thread starter Thread starter Guest
  • Start date Start date
G

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
 
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.
 
Try this
SELECT TableName1.*
FROM TableName2 INNER JOIN TableName1 ON TableName2.[Property id]=
TableName1.[Property id]
WHERE TableName1.[property address])<>[TableName2].[owner address]))
 
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 said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top