为什么 id delete 用 where 子句删除所有行?

问题描述 投票:0回答:0

我正在尝试从表 A 中删除一些行,其中 where 条件引用另一个表。 所以基本上从表 A 中删除行也存在于表 B 中。

以下是我正在使用的查询:

delete Table_A from Table_A t1
join table_B t2
on t1.id = t2.id
where cndt_1 and cndt_2 and .... and cndt 7
-- The where conditions are just to check field values are same for multiple -- cols of the 2 tables

这个查询正在删除表中存在的每一行,我似乎不明白为什么。我也尝试过使用 left join 进行相同的查询。同样的结果。我尝试在 on 下添加 where 条件,并与 where 配对。在每种情况下,它都会删除所有行

sql sql-delete
© www.soinside.com 2019 - 2024. All rights reserved.