0

I'm new to SQL. I tried to delete the duplicate customer record where has same name and surname. This below is my command

delete duplicated_records from  (
  select row_number() over (partition by name, surname
                            order by name, surname) as rn
      ,          * 
  from customer
) duplicated_records where rn > 1;

Which throw me this error

ERROR:  syntax error at or near "duplicated_records"
LINE 1: delete duplicated_records from  (

But when I tested running just to see the record, I didn't get any error.

select duplicated_records from  (
  select row_number() over (partition by name, surname
                            order by name, surname) as rn
      ,          *
  from customer
) duplicated_records where rn > 1;

Could anyone please advise me if I did something wrong here. Thanks in advance.

Tiger
  • 21
  • 1
  • 1
  • 3

0 Answers0