dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

Help removing all but the FIRST of duplicate records - informix

This is a discussion on Help removing all but the FIRST of duplicate records - informix ; Greetings, I am trying to remove duplicate records from a table but preserving one of them using temp tables/etc. Pretty much removing duplicates but leaving one of the identical sets. Example DATA would like like: col1, col2, col3 20, 1090 ...


Home > Database Forum > Other Databases > informix > Help removing all but the FIRST of duplicate records

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 08-19-2009, 04:08 PM
Database Newbie
 
Join Date: Aug 2009
Posts: 1
wgre0111 is on a distinguished road
Unhappy Help removing all but the FIRST of duplicate records

Greetings,

I am trying to remove duplicate records from a table but preserving one of them using temp tables/etc. Pretty much removing duplicates but leaving one of the identical sets.

Example DATA would like like:

col1, col2, col3
20, 1090, bad
22, 1090, bad
25, 1090, bad
28, 1091, good
2350, 2444, bad
2353, 2444, bad
2370, 2444, bad
3000, 5000, good
3005, 5001, good



AFTER the DELETE sql (which I need help with)
example data (based off of above) should look like


col1, col2, col3
20, 1090, bad
28, 1091, good
2350, 2444, bad
3000, 5000, good
3005, 50001, good


Please notice that one of each of the sets that had duplicates remains.



The records the new sql would need to focus on would be records on col2 With counts(col2) >1 should not have two col2's with data like 1090. All but one of them would need to be deleted. Doesnt matter which one is left.


Please help!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Re-post: How to join 2 awk commands into one, using the output of thefirst as the matching pattern of the second? Database Administrator shell 15 08-18-2008 12:46 PM
What's the best way of removing duplicates records? Database Administrator sqlserver-faq 3 07-15-2008 06:47 PM
updating duplicate records with unique random number Database Administrator mysql 2 07-14-2008 11:19 AM
Modify duplicate records using VBA code Database Administrator ms-access 6 07-01-2008 07:48 AM
Duplicate Records Database Administrator sqlserver-programming 2 05-05-2008 04:41 PM


All times are GMT -4. The time now is 03:08 PM.