Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GROUP BY 1 no longer works
Message
From
17/02/2003 13:29:53
 
 
To
17/02/2003 11:27:13
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00750415
Message ID:
00754179
Views:
46
>I see the problem clearly regarding DISTINCT. Not so with GROUP BY, but I take your word for it.

Jim - did you run the GROUP BY example? Try this query first:
OPEN DATABASE HOME(2)+"TasTrade\Data\TasTrade"
SELECT customer_id, order_date, freight ;
   FROM orders ;
   ORDER BY 1 ;
   INTO CURSOR fullresult
Then run the one I posted:
OPEN DATABASE HOME(2)+"TasTrade\Data\TasTrade"
SELECT customer_id, MAX(order_date), freight ;
   FROM orders ;
   GROUP BY 1 ;
   INTO CURSOR result
If you look, you'll see that the Freight field in Result comes from the last record for each customer in date order. Oh, bad example, change MAX() to MIN() and you should get the point.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform