Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP8 GROUP BY Restriction
Message
De
29/05/2003 08:22:03
 
 
À
28/05/2003 18:53:46
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:
00793870
Vues:
28
>Hi Sergey,
> That's an interesting idea, but it might not give a complete row. It could give some columns from one row and some columns from another row. I don't care which row it gives, but it has to be a complete row, that is, all the columns must come from a single row.
> Is there any other way to get around the GROUP BY constraint?

For what you're looking for, you really need to use two queries in sequence. The first query identifies the records of interest and the second extracts the data from them.

I don't know what your exact case is, but here's an example.


SELECT Customer_ID, MAX(Order_Date) AS MaxDate ;
FROM Orders ;
GROUP BY 1 ;
INTO CURSOR RecentOrders

SELECT RecentOrders.Customer_ID, Order_No, Order_Date ;
FROM Orders ;
JOIN RecentOrders ;
ON Orders.Customer_ID = RecentOrders.Customer_ID ;
AND Orders.Order_Date = RecentOrders.Order_Date ;
INTO CURSOR Result

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform