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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -