Takes an id from the users table, and searches the phones_user table phones_user this id in the id_users column, if it id_users , it deletes the record.
There is such a query: DELETE FROM phones_users WHERE id_user = 213 it works.
Таблица `users` +-----+-----------------+---------------+ | id | user_first_name | user_last_name| +-----+-----------------+---------------+ | 213 | Eugen | Podlevskykh | +-----+-----------------+---------------+ | 214 | Dima | Mukhin | +-----+-----------------+---------------+ Таблица `phones_users` +-----+-----------+------------+ | id | id_user | phone_1 | +-----+-----------+------------+ | 180 | 213 | 0993331285 | +-----+-----------+------------+ | 181 | 214 | 3663223345 | +-----+-----------+------------+ This one no
DELETE `users`, `phones_users` FROM `users` JOIN `phones_users` ON users.id = phones_users.id_user WHERE phones_users.id = 213 The request is made, there are no errors, and the answer comes:
Затронуто 0 строк. (Запрос занял 0,0000 сек.)
WHERE phones_users.id_user = 213instead of the filter by id? Well, orWHERE users.id = 213- Minorphones_users.id = 213. - AkinaWHERE phones_users.id = 213you needWHERE users.id = 213- Misha Podlevsky