Link to home
Start Free TrialLog in
Avatar of skull52
skull52Flag for United States of America

asked on

Update target table column value when source table column value is different

I have an access table tbl_Items_UPC (Target Table) with a QTYONHND column that I want to only update from dbo_SSG_UPC_SCAN (Source Table) when the source value changes. I work mostly with SQL and it has a MERGE function that does that very well. I suspect that I would have to use an update query in access to accomplish this, I have tried a couple of queries but it didn't seem to work. I am using Access 2016
Avatar of Paul Cook-Giles
Paul Cook-Giles
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Agree with Paul's comment.
Here is an application to table a(aid, f) as source, and table b(aid, f1) as target.
Need to update f1 in target when f1 is different.
UPDATE b AS target INNER JOIN a AS source ON target.aid = source.aid SET target.f1 = source.f1
WHERE (((target.f1)<>[source].[f1]));

Open in new window

Avatar of skull52


Thanks Paul, I should have figured that out, that is how I would have done in in SQL if I didn't use  SQL's MERGE Function