Chester Friesen wrote:
> I need all the 
> records in the table to show in the report sorted by the order that the 
> above came up with. i.e., sorted by the Names, but in the order of the 
> Totals. I hope I'm making sense! Actually the example below should be 
> descending instead of ascending, but that's an easy part.
>
> Main Heading
>       Name1
>                  01/01/07                           50
>                  01/01/07                           25
>                             Total->                  75
>       Name2
>                  01/01/07                           40
>                  01/01/07                           44
>                             Total->                  84
>       Name3
>                  01/01/07                           45
>                  01/01/07                           44
>                             Total->                  89
>   
O.I.C.

Well, Here's one way:

SELECT rider, SUM(nscore) as totscore FROM foobar GROUP BY rider INTO 
CURSOR totcurs nofilter

SELECT Foobar.Rider, Foobar.Ddate, Foobar.Nscore, totcurs.totscore ;
 FROM foobar INNER JOIN totcurs ON foobar.rider = totcurs.rider ;
 ORDER BY 4 desc,1

Output:
Name3     20070101  44              89
Name3     20070101  45              89
Name2     20070101  40              84
Name2     20070101  44              84
Name1     20070101  50              75
Name1     20070101  25              75




_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to