I am pulling a set of records from a big table, based on a filter condition in the select statement.
I also want to create a field with the sequential number of those records.

Example:

select *, (function to number records) as recnbr from bigtable where filtercondition into cursor curFiltered readwrite

What I need is a function or method to fill the recnbr field with sequential numbers, starting at 1 such that the resulting filtered set looks like:

coname            city                  recnbr
Widgets inc     New York            1
John Doe's       New York            2
etc

The filter is the city (New York) and the table has more than one million records

I know I could select the recnbr field as zero and then use a scan endscan construct to replace it with the numbers, like

nRec = 0
select curFiltered
scan all
       nRec = nRec + 1
       replace recnbr with nRec
endscan

But I wonder if it would not be much faster if the record numbers came directly calculated in the select statement

Rafael Copquin


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** 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