Negated SELECT query

2009-03-17 Thread BobSharp
3 tables are related by one-many links. Employees Assets Maintenance Employees can be assigned = 0 Assets Assets can have = 0 occurances of Maintenance. Assets table contains EmployeeIDs and MaintenanceIDs, but no Foreign Key contraints. Queries ... 1) which Employees

Re: Negated SELECT query

2009-03-17 Thread Perrin Harkins
On Tue, Mar 17, 2009 at 12:42 PM, BobSharp bobsh...@ntlworld.com wrote: These have been written successfully with Sub-Queries, I would like to know how they can be done with only JOINs  ? http://dev.mysql.com/doc/refman/5.0/en/rewriting-subqueries.html - Perrin -- MySQL General Mailing List

RE: Negated SELECT query

2009-03-17 Thread Bonnett, John
@lists.mysql.com Cc: wi...@lists.mysql.com; mysql-h...@lists.mysql.com Subject: Negated SELECT query 3 tables are related by one-many links. Employees Assets Maintenance Employees can be assigned = 0 Assets Assets can have = 0 occurances of Maintenance. Assets table contains

Re: Negated SELECT query

2009-03-17 Thread BobSharp
, March 17, 2009 10:59 PM Subject: RE: Negated SELECT query SELECT Employees.* FROM Employees LEFT JOIN Assets ON Employess.EmployeeID = Assets.EmployeeID WHERE Assets.EmployeeID IS NULL The one for assets with no maintenance is similar. The point is the left join above produces in its output all