Update a field thanks to a subquery based on another field
- by Nicolas
Hi,
I use a MySQL DB, and I would like to update a filed in a table based on another. Something like:
UPDATE table1
SET field1 = table2.id
WHERE field2 IN (
SELECT table2.name
FROM table2
);
I know that this query wouldn't work, but here is the idea. Is that even possible to do?
Cheers,
Nicolas.