Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cool way to eliminate duplicate column values?
Message
De
09/04/2001 17:36:58
 
 
À
06/04/2001 22:34:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00493142
Message ID:
00493810
Vues:
14
For the benefit of all, here is a solution that meets my requirements and is very clean. The solution comes from a "lurking friend" who prefers to remain anonymous:

Just to recap: my specific problem is to retrieve the initial work order for each part my company makes from a table of workorders. I can assume that the work order having the lowest number (a regular key), is the initial work order.

Here's the solution:
SELECT nPart, MIN( nWorkOrder ) AS nWorkOrder ;
>>  FROM WorkOrders;
>>  ORDER BY nPart, nWorkOrder ;
>>  INTO CURSOR curWorkOrders ;
>>  GROUP BY nPart,nWorkOrder
>>  NOFILTER
Thanks to all for your suggestions, some of which didn't quite give what I was looking for (probably because my original problem statement was confusing....sorry!), and some which did succeed, but required multiple (or sub) queries.

(Actually, in our case, work orders can be duplicated if we produce a PO line item in lots, so a SELECT DISTINCT is required...but that's a minor DISTINCTion [g])
"The Iron Fish: The water is cold...but the fish don't mind"
...Jay Jenks, boyhood chum
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform