Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Wennerwik
  Where is Anders Wennerwik?
 Ross-on-Wye
 United Kingdom
 Anders Wennerwik
 To: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 Tags
Subject: RE: Ranking
Thread ID: 112413 Message ID: 112440 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Wednesday, November 08, 2006 4:31:58 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

>
>
> I am not sure what you mean, can you give me some more info? If you want to get a result set ordered by country and then by employees try:
>
> SELECT Country, CompanyName, Employees;
>        FROM MyCompanyCursor;
> ORDER BY UPPER(Country), Employees DESC;
> INTO CURSOR crsTest
> 

>
> If you already have a cursor and just want to create an index that will order that cursor by Contry and then bu employees descending try:
>
> SELECT MyCursor
> INDEX ON UPPER(Country)+STR(9999999 - Employees,7,0) TAG MyCursor
> 
?
>
>
>
>
> Borislav Borissov
>
>


I forgot to add that I have a 4th column that should be filled with the ranking number i.e
Argentina, Company A, 11 employees, ranked 3
Argentina, Company B, 6 employees, ranked 6
Argentina, Company C, 8 employees, ranked 4
Argentina, Company D, 75 employees, ranked 1
Argentina, Company E, 8 employees, ranked 4
Argentina, Company F, 35 employees, ranked 2

the ranking of the company of will be based on the number of employees in each company by country.

Anders

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