我正在尝试从两个复杂的子查询中删除匹配的行。我正在使用postgresql。这是示例代码:
DELETE FROM complex_subquery1 as a
USING complex_subquery2 as b
WHERE a.column1 = b.column2
我在这里阅读:PostgreSQL: delete rows returned by subquery,这种方式实际上是不可能的。删除内部联接是否有快捷方式?
答案 0 :(得分:0)
通常的方法是
DELETE FROM atable
USING complex_subquery1 as a,
complex_subquery2 as b
WHERE a.column1 = b.column2
AND a.column3 = atable.column4;