Postgresql删除加入

时间:2016-04-01 22:17:59

标签: sql postgresql left-join

DELETE i
FROM
data_positive AS p, 
incident AS i
WHERE p.id in (
SELECT max(id)
FROM data_positive
GROUP BY url
HAVING count(*) > 1)
AND p.id = i.data_positive_id

当我尝试上面的查询删除事件表时,我得到以下错误。

ERROR:  syntax error at or near "i"
LINE 1: delete i
               ^
********** Error **********

ERROR: syntax error at or near "i"
SQL state: 42601
Character: 8

我用左外JOIN尝试了但是我有同样的错误。查询有什么问题?

0 个答案:

没有答案