List:General Discussion« Previous MessageNext Message »
From:Chris W Date:October 12 2007 8:38pm
Subject:Not In join query.
View as plain text  
I have 2 queries to give me a list of names.

Q1:
SELECT DISTINCT FName, LName
FROM user u
JOIN userprofile p
USING ( UserID )
JOIN trainingstatus t
USING ( UserID )
WHERE ProgramID =12
ORDER BY LName, FName

Q2
SELECT DISTINCT FName, LName
FROM namelist
WHERE `Date`

What I need is query that will give me a list of names that are in the 
Q2 result but not in the Q1 result. 
This is easy enough if I am just doing the match on one filed I can do this

SELECT Name
FROM
namelist
WHERE `Date` AND Name NOT IN(
SELECT Name
FROM . . . . . . )

What I can't figure out is how to do it if I want to match of FName and 
LName.  I tried to use concat to build the full name and do the not in 
based on the new field MySQL didn't like that query at all.


-- 
Chris W
KE5GIX

"Protect your digital freedom and privacy, eliminate DRM, 
learn more at http://www.defectivebydesign.org/what_is_drm"


Thread
Not In join query.Chris W12 Oct
  • Re: Not In join query.Baron Schwartz14 Oct