Hello I fighting mysql and could use some help , i am not doing it correctly I have 2 tables : table1 contains : title created_by second table : userName userID The titles are the same but the id are differents. What i want to do is compare the title fields of the 2 tables and each time they match, replace the id of the first table with the id of the second one I used this but it failed UPDATE table1 SET created_by = {SELECT table2.userID FROM table2 WHERE table2.userName = table1.title) WHERE EXISTS (SELECT table2.userID table2 WHERE table2.userName = table1.title); Code (markup): Thanks for your help
hope this query will help you. update table1 as t1,table2 as t2 set t1.created_by=t2.userID where t1.title=t2.userName; Code (markup): regards, --amrush