我有三个表,它们与下图匹配:
我需要从join_table中删除一些数据,其中label列(table_right)和name列(table_left)匹配某些条件。
我的解决方案是使用临时表:
create temporary table if not exists data_for_deletion
(select jt.id
from join_table jt
left join table_left tableLeft on jt.table_left_id = tableLeft.id
left join table_right tableRight on jt.table_right_id = tableRight.id
where tableLeft.name = 'name' and tableRight.label = 'label');
delete from join_table where id in (select id from data_for_deletion);
我的问题是:还有其他方法可以在不创建临时表的情况下进行这种删除吗?
答案 0 :(得分:1)