Priya Bhosle

Priya Bhosle

  • NA
  • 9
  • 956

Delete all row accept 1 from selected total rows in sql

Apr 9 2015 4:06 AM
I have one table it contains many duplicate rows for single value.for eg below
 
suppose there is one record with above ACCS_NO= 004068 value.with this value there are total 3 rows with same records accept doc_no.so I want to delete top 2 from 3
records i.e.  doc_no=008446 & 008447(here in this table doc_no is auto generated id).I want to do this for whole table at one time in sql only.
 
please help to solve this problem.how can I do this?I want to do this for all duplicate records?

Answers (4)