php - Deleting using Inner Joing having FK -
i need query.
this tables :
table 1 - general id name last_name
table 2 - user id username table1_id (this 1 references table1 ids) - fk
since references on cascade, if delete table1, delete others.
but don't know how query.
i want first id in table2 table2.table1_id , go table1 , delete id got.
delete table1
your keys on cascade, delete rows in table2
you can delete 1 row table1 same normally
delete table1 id=to_delete
this cascade , delete rows in table2 referenced to_delete
ok; edit again
delete table1 id=(select table1_id table2 id=group_to_delete)
will delete row table1 id row in table2, cascade , delete rows in table2 share same key.
Comments
Post a Comment