Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find distinct records that are not distinct
Message
De
20/11/2007 10:30:13
 
 
À
17/11/2007 16:37:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01269536
Message ID:
01270168
Vues:
14
>>>>Huh? I know, its a strange subject line. Here's my problem. Through something of a snafu we have about 600 records in a table that are improper duplicates of other records. We want to remove them. This would be easy with select distinct EXCEPT that one field "sequence" was provided to create a unique sequence number for each record. So, they are all distinct because they all have different sequence numbers. I can get around this by selecting into a cursor, deleting the sequence numbers, and then selecting dist from the cursor. This gives me the truly distinct records albeit without the sequence numbers. Now I need to put the original sequence numbers back. Any ideas on how to do this?
>>>
>>>
>>>Can you do something like:
>>>
>>>Select max(seqfield), field1, field2, field3, etc from table into cursor crsrname group by field1, field2, field3, etc
>>>
>>>Will that give you your distinct records?
>>
>>On the surface at least that seems to work. Thank you very much. I've never really understood the GROUP BY clause. Is there a simple explanation for dummies of what it does?
>>
>>Thanks again
>
>I don't know how 'dummiefied' this is, but try this: http://publib.boulder.ibm.com/infocenter/db2v7luw/index.jsp?topic=/com.ibm.db2v7.doc/db2y0/db2y025.htm
>
>When you get there, on the left, under 'Chapter 4', select grouping (at the bottom of the chapter 4 headings).

My thanks to all of you who helped with this. Your input was very helpful.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform