* A. Pagaltzis <[EMAIL PROTECTED]> [2006-05-23 09:40]: > Now we can group together the conditions which do not involve > the `bounds` table: > > (r.qi = 5604 AND r.ri <= 5468) OR (r.ri = 5468 AND r.qi <= 5604) > AND r.qi >= b.bqis > AND r.ri >= b.bris > AND b.bi = 1
Ack. The ORed clauses need to be parenthesised: ((r.qi = 5604 AND r.ri <= 5468) OR (r.ri = 5468 AND r.qi <= 5604)) AND r.qi >= b.bqis AND r.ri >= b.bris AND b.bi = 1 > The rest can then be factored into a subquery: Same bug slipped into this query. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>