Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP8 GROUP BY Restriction
Message
De
29/05/2003 09:54:59
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00793077
Message ID:
00793907
Vues:
75
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform