我在 Postgres 中使用 CTE 编写了以下查询。现在我无法从中删除记录。
WITH cte AS (
SELECT
firstname,
lastname,
country,
ROW_NUMBER() OVER (
PARTITION BY
firstname,
lastname,
country
) row_num
FROM
employee
)
delete from cte
where row_num >1
Run Code Online (Sandbox Code Playgroud)
当我运行此查询时,它显示错误:
关系“cte”不存在
这是我的表“员工”的示例
id firstname lastname country
1 "Raj" "Gupta" "India"
2 "Raj" "Gupta" "India"
3 "Mohan" "Kumar" "USA"
4 "James" "Barry" "UK"
5 "James" "Barry" "UK"
6 "James" "Barry" "UK"
Run Code Online (Sandbox Code Playgroud)