Please, could you help me, how to delete data from more than 1 table in just one query? I have this tables structure:
products
texts
files
products_files - here are mapped files to products - product_id, file_id texts_files - here are mapped files to texts - text_id, file_id
And I need to do this: If I delete file with id 50, I need to delete all rows from products_files and texts_files where file_id = 50.
Do you know, how to do it?
I tried to use left join, but without any results...
$query = 'DELETE products_files, texts_files FROM products_files
LEFT JOIN texts_files ON texts_files.file_id = products_files.file_id
WHERE products_files.file_id = '.$id.' OR texts_files.file_id = '.$id.'';