If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

The joins are executed prior the where, so sql can come up with a different plan. The LEFT-join makes it a diffrent qry: in a lef/right join those without a match are NULL including company.company_id <> 1.

SELECT employee.employee_id
FROM employee
INNER JOIN company
ON employee.company_id = company.company_id
AND company.company_id != 1
--in order to have a "balanced JOIN" you need to add another line here
AND employee.company_id != 1

"The data in a record depends on the Key to the record, the Whole Key, and
nothing but the Key, so help me Codd."