Compare two table fields.

J

JLD

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
 
B

Brendan Reynolds

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.
 
O

Ofer

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

Ofer

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
 
Top