Reputation: 2166
I have the following sql query:
UPDATE
(SELECT * FROM table_A INNER JOIN table_B
ON table_A.id=table_B.a_fk
WHERE table_A.batch=10) AS TBL_1
SET TBL_1.b_name = "test" WHERE TBL_1.a_fk = 67532;
When i run it, i get the following error message:
The target table TBL_1 of the UPDATE is not updatable.
I need to update the column 'b_name' in table_B where the batch value is 10 in table_A.
Any help is most appreciated.
Upvotes: 2
Views: 9096
Reputation: 5714
update table_B b
set b.b_name = 'test'
where b.a_fk in
(
select id from table_A where batch=10
)
Upvotes: 1