The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay(No Description) sql: SELECT DISTINCT p.id FROM products p, productoffers o WHERE p.id IN (SELECT product_id FROM productoffers WHERE 1 ) OR p.parent_id IN (SELECT product_id FROM productoffers WHERE 1 )