RE: [sqlite] Help wiith SQL - first row of each group

2007-05-08 Thread Adler, Eliedaat
e first row per group. Thanks again, Eliedaat -Original Message- From: Ed Pasma [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 10:28 PM To: Adler, Eliedaat Cc: sqlite-users@sqlite.org Subject: RE: [sqlite] Help wiith SQL - first row of each group This solution may is tricky

Re: [sqlite] Help wiith SQL - first row of each group

2007-05-07 Thread Tomash Brechko
On Mon, May 07, 2007 at 19:20:49 +0400, Tomash Brechko wrote: > But with SQLite 3.x there is only one user data pointer per user > defined aggregate function, so no parallel aggregate execution is > possible. Ah, I was too fast again :/. GROUP BY is really two-pass, but my understanding why it

Re: [sqlite] Help wiith SQL - first row of each group

2007-05-07 Thread Tomash Brechko
On Mon, May 07, 2007 at 18:10:29 +0400, Tomash Brechko wrote: > The solution with two table scans might be > > SELECT * FROM RESULT_TABLE a > WHERE P = (SELECT MIN(P) FROM RESULT_TABLE b WHERE b.G = a.G); > > You may also try to play with indexes G, P. > > It seems to be impossible to do

RE: [sqlite] Help wiith SQL - first row of each group

2007-05-07 Thread Adler, Eliedaat
that "scans" TEST only once? -Original Message- From: Maulkye [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 4:35 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Help wiith SQL - first row of each group How about something like this: create table test ( G

Re: [sqlite] Help wiith SQL - first row of each group

2007-05-07 Thread Tomash Brechko
On Mon, May 07, 2007 at 15:38:22 +0300, Adler, Eliedaat wrote: > I need to define a query that returns only the "first' row in each group > - i.e. the row with the lowest display priority: > > - most preferably a query that doesn't require selecting RESULT_TABLE > more than once. The solution

Re: [sqlite] Help wiith SQL - first row of each group

2007-05-07 Thread Maulkye
=pri.Grp and grp.Pri=pri.Pri Grp Val Pri --- AX1 BZ2 CY6 - Original Message From: "Adler, Eliedaat" <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Monday, May 7, 2007 8:38:22 AM Subject: [sqlite] Help wiith SQL - first r

[sqlite] Help wiith SQL - first row of each group

2007-05-07 Thread Adler, Eliedaat
Hi guys, I have a complex query result set RESULT_TABLE that returns: GVP ___ AX1 AX2 BY4 BZ2 BX8 CY6 CZ8 CX9 CY11 G