I'm attempting to use the following code to JOIN
my MySQL tables, TableA
and TableB
, when both their owner
and pos
columns match, setting TableA
's val
in the matching record to TableB
's val
:
UPDATE TableA A
JOIN TableB B
ON A.owner = B.owner AND A.pos = B.pos
SET A.val = B.val
TableA has around 100,000 records and TableB has around 10,000 and there should only be one owner
/pos
match in each table.
When I execute this query everything just hangs and I end up having to abort the execution. Is there something I'm missing syntactically or otherwise to get my desired result?
Edit:
I have also tried the following; the results were the same:
UPDATE TableA
JOIN TableB
ON TableA.owner = TableB.owner AND TableA.pos = TableB.pos
SET TableA.val = TableB.val