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.
I also tried to build a subquery but I am still stuck.
Can anyone give me some direction or offer advice as to how to get the results I need? Thank you.
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.