mysql - Delete rows in table based on values in other table -
i have simplified table (table1):
id | note ---------------------------------- 1 | note 2 | note 3 | note 4 | note
and 1 (table2):
id | note ---------------------------------- 1 | note 2 | note 3 | note 4 | note
based on id table1 want delete rows table2 table1.note equal table2.note.
if provide tabel1´s id=3, rows id 2 , 4 of table2 should deleted.
i tried:
delete table2 join table1 id = ? table1.note = table2.note
but getting "er_parse_error".
what correct mysql syntax?
you can join
between table1 , table2 in delete
statement.
delete t2 table2 t2 join table1 t1 on t1.note = t2.note , t1.id =3
Comments
Post a Comment