Let's try this. I apologize for my choice of software. We use ASC Sequel in
our shop. Perhaps this solution could be adapted to your toolset.

I would perform this in two commands. One to create a new results file with
a rank column. The initial value in this column will have no meaning.

The second command will update the rank column. ROWID returns the cursor for
the current row, which was suggested by a previous reader:

1. EXECUTE SQL('select custno, dolrsold, rowid name(rank)
     from testfile order by dolrsold desc')

2. UPDATE SET((RANK ROWID)) SQL('from workfile')

Hope this helps.

Clayton Char
Director of Business Systems
The Honolulu Advertiser

>----- Original Message -----
>From: "Alan Novick" <mida@pressmantoy.com>
>To: "MidRange-L" <MidRange-L@MidRange.Com>
>Sent: Tuesday, January 29, 2002 1:45 PM
>Subject: Can you do this in SQL
>Lets say I have a file with three fields, customer number, dollars sold,
>rank.  I can fill the customer number and dollars sold fields from my
>I then one to put a number in the rank field, so that the customer who
>bought the most gets a ranking of one, the one who bought less gets 2,
>Is there a way to do this in sql?
>Alan Novick
>Pressman Toy Corporation
>New Brunswick, NJ

Send and receive Hotmail on your mobile device: http://mobile.msn.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.