Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP8 GROUP BY Restriction
Message
From
29/05/2003 09:54:59
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00793077
Message ID:
00793907
Views:
76
Hi Sergey & Tamar,
Ok, I see what you're suggesting. The problem I see is that the order date might not be unique and there might not be any column that is sure to be unique so you can't really use the MAX() idea to generate a unique value. Tamar, in your example, if you have two rows with the same customer id and same order date, you'd get two records in the result.
Sergey, I tried your suggestion (see below) but I can't figure out how to do a join based on a row number:

* this step works
SELECT Customer_ID, MAX(RECNO()) AS nRecNo ;
FROM Orders ;
GROUP BY 1 ;
INTO CURSOR RecentOrders

* this step will not work
SELECT RecentOrders.Customer_ID, Order_No, Order_Date ;
FROM Orders ;
JOIN RecentOrders ;
ON Orders.Customer_ID = RecentOrders.Customer_ID ;
AND RECNO(Orders) = RecentOrders.nRecno ;
INTO CURSOR Result

Any other ideas? Is there some way to use the RECNO as a pointer to the desired row?

Thanks, Chaim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform