Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Order of a SQL on a SUM column
Message
From
07/04/2001 19:28:16
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
07/04/2001 16:27:58
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00493266
Message ID:
00493290
Views:
18
Michel,

The following will also work:
SELECT NonMember2, SUM(Point) AS SumOfPoint ;
  FROM Point ;
  INTO CURSOR Temp ;
  GROUP BY NonMember2 ;
  ORDER BY SumOfPoint DESCENDING
Your problem was that it didn't know which "Point" to order by.


>
>How come on the following SQL:
>>
>>
>>SELECT NOMEMBER2,SUM(POINT) AS POINT FROM POINT;
>> GROUP BY 1 ORDER BY POINT DESCENDING INTO CURSOR TEMP
>>
>>
>>I would end up with a sort with the following values in my POINT column: 10, 10, 2, 2, 12?
>>
>>The record with 12 as the POINT value should be ranked 1st.
>
>Order by 2 solved it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform