List:General Discussion« Previous MessageNext Message »
From:Titan 160 Date:May 26 2003 3:54pm
Subject:RE: How to write this query pls?
View as plain text  
Thanks to all who responded. 

And especially to Bruce for providing the answer.

[Filter; SQL]

-----Original Message-----
From: Bruce Feist [mailto:bfeist@stripped] 
Sent: Monday, May 26, 2003 5:17 PM
To: Titan 160
Subject: Re: How to write this query pls?


Titan 160 wrote:

>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.
>
>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...
>  
>
SELECT *
  FROM persons pe LEFT JOIN phones ph ON pe.personID = ph.personID AND 
ph.type = 'PHN'
  WHERE ph.type IS NULL;

ought to do the trick.


Thread
How to write this query pls?Titan 16026 May
  • Re: How to write this query pls?Becoming Digital26 May
    • RE: How to write this query pls?Titan 16026 May
      • Re: How to write this query pls?Becoming Digital26 May
        • Re: How to write this query pls?Aamir Baig26 May
          • RE: How to write this query pls?TheMechE26 May
            • Re: How to write this query pls?Aamir Baig27 May
              • Re: How to write this query pls?Dan Nelson27 May
            • Re: How to write this query pls?Peter Brawley27 May
      • Re: How to write this query pls?Peter Brawley26 May
RE: How to write this query pls?Titan 16026 May