Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cool way to eliminate duplicate column values?
Message
From
09/04/2001 17:36:58
 
 
To
06/04/2001 22:34:16
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00493142
Message ID:
00493810
Views:
15
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform