Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tamar Granor
  Where is Tamar Granor?
 Elkins Park
 Pennsylvania - United States
 Tamar Granor
 To: Anders Wennerwik
  Where is Anders Wennerwik?
 Ross-on-Wye
 United Kingdom
 Anders Wennerwik
 Tags
Subject: RE: Ranking
Thread ID: 112413 Message ID: 112480 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Wednesday, November 08, 2006 10:46:59 PM         
   


> Hi,
> I've got a small problem that I keep coming back to without any luck.
> Here goes...
>
> I have a cursor containing a number of countries with companies based in the country with numbers of employees belonging to each company.
>
> Argentina, Company A, 11 employees
> Argentina, Company B, 6 employees
> Argentina, Company C, 8 employees
> Argentina, Company D, 75 employees
> Argentina, Company E, 8 employees
> Argentina, Company F, 35 employees
> Belgium, Company A, 11 employees
> Belgium, Company B, 6 employees
> Belgium, Company C, 8 employees
> Belgium, Company D, 75 employees
> Belgium, Company E, 8 employees
> Belgium, Company F, 35 employees
>
> and so on...
>
> What I need is to order the list by country(easy), company size(number of employees), and then, and this is turning out to be rather problematic. I need to have a field containing their ranking.
> Any ideas?
>
> Anders


SELECT Sorted.*, RECNO() AS Rank ;
FROM (SELECT * ;
FROM YourTable ;
ORDER BY Country, Employees) Sorted ;
INTO CURSOR SortedAndRanked

Tamar

ENTIRE THREAD

Ranking Posted by Anders Wennerwik @ 11/8/2006 10:55:55 AM
RE: Ranking Posted by Noker Lodia @ 11/8/2006 12:04:46 PM
RE: Ranking Posted by Borislav Borissov @ 11/8/2006 12:09:13 PM
RE: Ranking Posted by Anders Wennerwik @ 11/8/2006 4:31:58 PM
RE: Ranking Posted by Borislav Borissov @ 11/8/2006 5:49:22 PM
RE: Ranking Posted by Tamar Granor @ 11/8/2006 10:46:59 PM
RE: Ranking Posted by Anders Wennerwik @ 11/9/2006 9:35:31 AM
RE: Ranking Posted by Borislav Borissov @ 11/9/2006 11:20:59 AM