我有 7 个表我需要从所有表中删除数据,但有时我在其中一个表中没有数据,因此常规 DELETE 不起作用(返回 false)
DELETE `lead`.*, `wp_users`.*, `wp_sfmembers`.*, `wp_usermeta`.*,
`crm_notes`.*,`deposits`.*,`meta_accounts`.*
FROM `lead`, `wp_users`, `wp_sfmembers`,
`wp_usermeta`, `crm_notes`,
`deposits`, `meta_accounts`
WHERE
`wp_users`.`ID`=`lead`.`uid`
AND `wp_sfmembers`.`user_id`=`lead`.`uid`
AND `wp_usermeta`.`user_id`=`lead`.`uid`
AND `crm_notes`.`uid`=`lead`.`id`
AND `deposits`.`uid`=`lead`.`id`
AND `meta_accounts`.`uid`=`lead`.`id`
AND `lead`.`id`='89'
我尝试使用 JOIN 但它删除了我错误的数据:
DELETE `l`.*
FROM `lead` as `l`
LEFT OUTER JOIN `wp_users` ON `wp_users`.`ID`=`l`.`uid`
LEFT OUTER JOIN `wp_sfmembers` ON `wp_sfmembers`.`user_id`=`l`.`uid`
LEFT OUTER JOIN `wp_usermeta` ON `wp_usermeta`.`user_id`=`l`.`uid`
LEFT OUTER JOIN `crm_notes` ON `crm_notes`.`uid`=`l`.`uid`
LEFT OUTER JOIN `deposits` ON `deposits`.`uid`=`l`.`id`
LEFT OUTER JOIN `meta_accounts` ON `meta_accounts`.`uid`=`l`.`id`
AND `l`.`id`='89'
请帮忙