I've looked on the web and tried many options but I sill cannot get this right.
I tried using the query builder, but that too gave errors. This is what I want to do.
UPDATE members
SET members.MNZID = mnz_members.MNZID
WHERE members.MemID = mnz_members.MemID
Unknown column mnz_members.MemID
I do have the capitals correct.
SQL update from one Table to another based on a ID match
Re: SQL update from one Table to another based on a ID match
For some reason, nearly every web example and solution provided only has one table listed in the update clause.
If you add both tables, then it works. !!!!!
UPDATE members , mnz_members
SET members.MNZID = mnz_members.MNZID
WHERE members.memID=mnz_members.memID
Most confused as I'm not updating mnz_members.
If you add both tables, then it works. !!!!!
UPDATE members , mnz_members
SET members.MNZID = mnz_members.MNZID
WHERE members.memID=mnz_members.memID
Most confused as I'm not updating mnz_members.
Re: SQL update from one Table to another based on a ID match
We are currently reviewing this post and will answer you as soon as possible.
Re: SQL update from one Table to another based on a ID match
The query should look as follows:
Please also see the following https://msdn.microsoft.com/en-us/library/ms177523.aspx
Code: Select all
UPDATE
m
SET
m.MNZID = mnz_m.MNZID
FROM
members m
JOIN
mnz_members mnz_m
ON
m.memID=mnz_m.memID