In message <[EMAIL PROTECTED]>
, Sri Narayan Shukla <[EMAIL PROTECTED]> writes
>set an auto increment counter based on mysql_numrows variable. This
>will give you the order number of the record.

Mysql_numrows gives a single figure, which is the number of rows
returned.

How can he use that to find out what position the record would be in,
WITHOUT returning the rows, which was what he asked?

I believe that what he wants to do is impossible, and the original
poster should concentrate on speeding the result - only return the field
which is required, and check that an index exists.

>
>
>On Nov 20, 2007 12:34 AM, agneady <[EMAIL PROTECTED]> wrote:

>> Is there a simple way of knowing the order of a specific record in a
>> returned results set without actually retrieving the actual result
>> set? For example, let's say that I have a query like this:
>>
>> select id, name, title from employees where dept=3
>>
>> And let's say that it returns the following data:
>>
>> 12, john smith, accountant
>> 22, john doe, auditor
>> 43, mary adams, editor
>> 17, jack smith, consultant
>>
>> Now, I'm interested in knowing the order of the record with id=43. So,
>> is there a query that would return the answer as 3 without actually
>> returning the entire result set above?
>>
>> I need this because sometimes I have queries that might return
>> thousands of records, and all I need to know is the order of one of
>> the records, regardless of the contents of any of the records.


-- 
Pete Clark

Sunny Andalucia
http://hotcosta.com/Andalucia.Spain

Reply via email to