Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Delete Duplicate with smaller index

$
0
0

I have a table with the following:

IDORDERP_ID
12340123456
12340654321
45670456123
45671456123
45672456123
45670987654
45671987654
45672987654
78900495874
78900123498
78900684259
78900154980

I want to say delete all but the largest numerical instances of records having count([ID]) > 1 and count([ORDER]) > 1. So my output of select * from table after delete would be:

IDORDERP_ID
12340654321
45670987654
45671987654
45672987654
78900684259

Having a heck of a time figuring this one out... help is GREATLY appreciated!!! Thanks.



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>