Re: [sqlite] SQL query, finding out which row a result is in

2007-04-23 Thread Gilles Roy
On Mon, Apr 23, 2007 at 09:26:53AM -0400, Stephen Oberholtzer wrote: 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.

RE: [sqlite] SQL query, finding out which row a result is in

2007-04-23 Thread Griggs, Donald
Hi Roy, If your statement "X" is represented below by "select ... Order by ..." Then would the following give you what you're looking for?? create temp table Xtab as (select Order by ); select ROWID from xTab where MemberID=4567373; (Without some "order by" clause, by the

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-23 Thread John Stanton
You don't have to read into a memory array. How about just running through your selection with an sqlite3_step and counting the rows? Gilles Roy wrote: On Sun, Apr 22, 2007 at 05:33:43PM -0500, P Kishor wrote: On 4/22/07, Gilles Roy <[EMAIL PROTECTED]> wrote: Given a arbitrary statement,

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-23 Thread Stephen Oberholtzer
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,

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-23 Thread Hugh Gibson
> You could do this: > > SELECT COUNT(*) from X where memberid < 4567373 That assumes that you are sorting by memberid, of course... Hugh - To unsubscribe, send email to [EMAIL PROTECTED]

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-23 Thread Hugh Gibson
> That is what I want to do. I want to know where the memberid is in > the list (imagine the list was a waiting list or something). Is there > not a way to just get the row number back? Is seems inefficient to > have to allocate all of the memory to hold all of the results and > then iterate

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-22 Thread P Kishor
On 4/22/07, Gilles Roy <[EMAIL PROTECTED]> wrote: On Sun, Apr 22, 2007 at 05:33:43PM -0500, P Kishor wrote: >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

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-22 Thread Gilles Roy
On Sun, Apr 22, 2007 at 05:33:43PM -0500, P Kishor wrote: 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. what do

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-22 Thread P Kishor
Your question is so confusing that I am going to assume there is something you have not been able to express in the asking of it -- 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.

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-22 Thread John Stanton
Why not use a "where member_id = '4567373'? Gilles Roy 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. For example, imagine statement X which returns a column

[sqlite] SQL query, finding out which row a result is in

2007-04-22 Thread Gilles Roy
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. For example, imagine statement X which returns a column of memberid. They can be ordered by first name, last name,