I have written a following query using CTE in Postgres. Now I am unable to delete records from it.
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
When I run this query it show me error:
relation "cte" does not exist
Here is sample of my table 'employee'
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"