Is there an elegant SQL statement for deleting duplicate records in a table, but only if X is the number of duplicates? So it allows up to 2 or 3 duplicates, but what is it? At present I have a statement that does the following: Remove table from table, left outer (duplicate from table group like Triad, Diplo 1, Duplex 2) 1, Select Max (ID) by Dupl 2. Maintenance as TDI) = Maintenance. Where are kept. Road is empty This works very well. But what I want to do now will only remove those lines, if they have more than 2 duplicates. Thanks with in the form of CT (select row_member ( )) (Divol1 by split, dupol2 sequence by id) from table as rn) from cte where rn & gt; 2; - or & gt; 3 etc. The query is being classified by a 'line number' for each record, (Dupl 1, Dupl 2) and ordered by ID. In fact, this line number is calculated as 'duplicate', which has the same duplicate 1 and duplex 2 and then specifies the number 1, 2, 3. If you want to keep ...
Comments
Post a Comment