Trying to determine if value in field has changed

Indigo

Registered User.
Local time
Today, 18:37
Joined
Nov 12, 2008
Messages
241
Hello all!

I am working in Access 2010 and I am trying to create a query that will determine if the value in a specific field has changed when comparing two tables.

I have a main table in the database and a temporary table that is created when data is imported from another source. I need to determine if the SalesPerson is different between the Main Table and the Temporary table for the same PK.

I have tried the unmatched query wizard and I am not getting the results I need.

Code:
SELECT * 
FROM TempSalesData 
LEFT JOIN Opportunities
ON TempSalesData.OpportunityID = Opportunities.OpportunityID
WHERE Opportunities.OpportunityID Is Null

I also tried to build a subquery but I am still stuck.

Code:
SELECT  *
FROM TempSalesData
WHERE NOT EXISTS (SELECT NULL
FROM Opportunities
WHERE TempSalesData.OpportunityID = Opportunities.OpportunityID AND TempSalesData.[Sales Representative] = Opportunities.[Sales Representative])

Can anyone give me some direction or offer advice as to how to get the results I need? Thank you.
 
Your criteria for selection is that the field in one table has a different value from the same field in a different table, correct? If so, look here . . .
Code:
WHERE Opportunities.OpportunityID Is Null
What I would expect to see here is something like . . .
Code:
WHERE Table1.Field1 <> Table2.Field1
 
That's it! Thank you.... staring at this too long.
 

Users who are viewing this thread

Back
Top Bottom