I think you are coming from the wrong angle. If you want the opposite, you should reverse your approach. Select all the names in the projects table, match them with names in the contacts, then filter it so you only have the ones without a match.

SELECT p.name,p.company FROM projects p
LEFT JOIN contacts c ON p.name=CONCAT(c.firstName, " ", c.lastName)
WHERE c.firstname IS NULL

I used the firstname field simply because I don't know your other column names. I don't know you data setup, so you may need to add a distinct clause in there to avoid duplicate names.

On Tuesday, February 4, 2003, at 12:25 PM, Nicholas Stuart wrote:

Ok I'm stumped on what I think should be a somewhat simple query. What I
have so far is a list of names that is in a list of projects AND in a the
main contact list by doing the following query:
SELECT p.name, p.company FROM contacts c, projects p WHERE
CONCAT(c.firstName, " ", c.lastName) = p.name AND c.company = p.company

This is good and works correctly, what I need now is the opposite of this.
The names that are in the project list but NOT in the contact list.
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to