Alejandro Muñoz Alejandro Muñoz - 5 months ago 8
MySQL Question

MySQL update set join and user join

hi I need help with this judgment MySQL

UPDATE
table1
SET
table1.campo1= '1'
FROM
table1
INNER JOIN
tabala2 ON tabale1.campo2 = table2.campo1
WHERE
table1.campo3 = table2.campo2

Answer

Update don't use from .. the table and the join first . then the set and last the where clause

UPDATE table1 
INNER JOIN tabala2 ON tabale1.campo2 = table2.campo1
SET table1.campo1= '1' 
WHERE table1.campo3 = table2.campo2