P粉1649427912023-08-28 10:18:24
DELETE a.*, b.* FROM messages a LEFT JOIN usersmessages b ON b.messageid = a.messageid WHERE a.messageid = 1
Translation: Delete from table messages, where messageid = 1, if table uersmessages has messageid = messageid of table messages, then delete the rowUser message table.
P粉5956057592023-08-28 09:11:20
Can't they be separated by semicolons?
Delete from messages where messageid = '1'; Delete from usersmessages where messageid = '1'
or
Just use INNER JOIN
as shown below
DELETE messages , usersmessages FROM messages INNER JOIN usersmessages WHERE messages.messageid= usersmessages.messageid and messages.messageid = '1'