List:General Discussion« Previous MessageNext Message »
From:Aamir Baig Date:May 26 2003 3:01pm
Subject:Re: How to write this query pls?
View as plain text  
The problem here is that it will return all records whose type is not 
PHN ,
This would result in persons that have type PHN and other types as well 
(the != PHN would still allow other types).

This is a problem, since mysql does not support subqueries yet, I've 
pondered at this for about 5 mins now, If I get the answer, I'll email 
it.

Regards,
Aamir
On Monday, May 26, 2003, at 07:20  PM, Becoming Digital wrote:

> The query should return all records that have no phone entries, hence 
> the
>     phone.type != 'PHN'
>
> If it's doesn't, then I'm lost.  Check the MySQL manual section on 
> SELECT syntax
> for more info.
>
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
>
>
> ----- Original Message -----
> From: "Titan 160" <titan160@stripped>
> To: "'Becoming Digital'" <subs@stripped>; "'MySQL List'"
> <mysql@stripped>
> Sent: Monday, 26 May, 2003 09:39
> Subject: RE: How to write this query pls?
>
>
> Thanks Edward,
>
> But that gives me ALL records in persons that have any ONE record in 
> phone.
>
> What I want is ONLY those records in persons that do NOT have a
> corresponding 'PHN' record in phone?
>
> Thanks again.
>
>
> -----Original Message-----
> 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';
>
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
>
>
> ----- Original Message -----
> From: "Titan 160" <titan160@stripped>
> To: <mysql@stripped>
> Sent: Monday, 26 May, 2003 04:42
> Subject: How to write this query pls?
>
>
> Hi,
>
> 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', 
> 'FAX'
>
> 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]
>
>
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>

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