Thanks very much for the prompt action! One other simple workaround, if performance is not a concern,
SELECT T2.A, T2.B, T1.D, T1.E, T1.F, T1.G, T1.H, MAX(T1.C) FROM T1, T2 WHERE T1.B = T2.B AND T1.C = T2.C GROUP BY T2.A || " " || T2.B || " " || T1.D || " " || T1.E || " " || T1.F || " " || T1.G || " " || T1.H; Performance is one of our big concerns so we will evaluate NGQP as soon as it comes out. Thanks again for the great work! Mi Chen mi.c...@echostar.com -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Wednesday, June 05, 2013 6:21 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Bug in SQLite 3.7.15-3.7.17 regarding group by query after joining two table with primary key index On Tue, Jun 4, 2013 at 2:42 PM, Chen, Mi <mi.c...@echostar.com> wrote: > All, I encountered a likely bug during development with latest SQL > versions (3.7.17)... It appears to be affecting the result of queries with > GROUP BY clause with partial join over two primary keys. > Your test case has been added here: http://www.sqlite.org/src/info/96afe50866 Your test works with the next-generation query planner (NGQP) but (as you observe) fails in 3.7.17. Probably this is due to one of the existing bug reports written against the ORDER BY optimizer in 3.7.17. The problem should be fixed when we cut over to the NGQP. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users