Reputation: 83
UPDATE tb1 SET percentage = 80
WHERE EXISTS (SELECT ip FROM tb1 WHERE tb1.ip IN (SELECT ip FROM tb2))
The above Mysql query is written to update percentage based on duplication of ip columns into tb1 and tb2. But it doesn't work. Mysql says that I cant make tb1 as target! How to resolve this issue?
Upvotes: 0
Views: 111
Reputation:
Join
of both should work.
Try below :
UPDATE tb1 join tb2 on tb1.ip=tb2.ip SET tb1.percentage = 80
Upvotes: 1