On 4/22/07, Gilles Roy <[EMAIL PROTECTED]> wrote:
Given a arbitrary statement, I need to find out which row a specific
result is in, as efficiently as possible. The arbitrary statement can
order the results any way it wants.

Let's say your resultset consists of 3 columns: memberid, lastname,
firstname.  Then you can do this:

create temp table _results (rownumber int AUTOINCREMENT, memberid int,
lastname text, firstname text);

insert into _results (memberid, lastname, firstname)
select memberid, lastname, firstname
from MainTable where whatever;

select * from _results where memberid=12345;

While this isn't a whole lot more efficient than just pulling
everything into the application and doing it that way, it will work
out a bit better if you need to do this for multiple member IDs.


--
-- Stevie-O
Real programmers use COPY CON PROGRAM.EXE

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to