LEFT JOIN phone USING ( id )
WHERE phone.id IS NULL AND phone.type = 'PHN'
But that gives me ALL records in persons that have any ONE record in
What I want is ONLY those records in persons that do NOT have a
corresponding 'PHN' record in phone?
From: Becoming Digital [mailto:subs@stripped]
Sent: Monday, May 26, 2003 3:26 PM
To: MySQL List
Subject: Re: How to write this query pls?
SELECT * FROM person, phone
WHERE person.id = phone.id
AND phone.type != 'PHN';
----- Original Message -----
From: "Titan 160" <titan160@stripped>
Sent: Monday, 26 May, 2003 04:42
Subject: How to write this query pls?
I'm not sure how to write this. Can you help pls?
I have 2 tables
persons & phone
persons has a 1->M with phone on personID.
phone can contain 3 'type' records relating to a person; 'EML', 'PHN',
I want to select _only_ those records in person which do NOT have a 'type'
'PHN' record in phone. Do I need a "NOT HAVING" or a "NOT IN" or...
Basically I don't know how to write the WHERE section of the call.
Can you help pls?
[filter: SQL, MYSQL]