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
翻译:从表messages中删除,其中messageid = 1,如果表uersmessages有messageid =表messages的messageid,则删除该行用户消息表。
P粉5956057592023-08-28 09:11:20
不能用分号分隔它们吗?
Delete from messages where messageid = '1'; Delete from usersmessages where messageid = '1'
或
只需使用INNER JOIN
,如下所示
DELETE messages , usersmessages FROM messages INNER JOIN usersmessages WHERE messages.messageid= usersmessages.messageid and messages.messageid = '1'