List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:March 16 1999 4:31pm
Subject:Re: How do I work around lack of UNION in MySQL?
View as plain text  
On Tue, Mar 16, 1999 at 09:56:47AM -0500, skip@stripped wrote:
>     select venue.name, locale.city, locale.state
> 	from venue, address, locale
> 	where (venue.address = address.id)
> 	    and (address.locale = locale.id)
> 	    and (venue.phone = 0)
>     UNION
>     select venue.name, locale.city, locale.state, phone.voice
> 	from venue, address, locale, phone
> 	where (venue.address = address.id)
> 	    and (address.locale = locale.id)
> 	    and (venue.phone != 0)
> 	    and (venue.phone = phone.id)
>     ;

I think this is right:

    SELECT venue.name, locale.city, locale.state, phone.voice
      FROM venue
         , address
         , locale
 LEFT JOIN phone ON (venue.phone = phone.id)
     WHERE venue.address = address.id
       AND address.locale = locale.id

The phone.voice field will be NULL for any venues that do not
have a matching phone id.

Tim
Thread
How do I work around lack of UNION in MySQL?skip16 Mar
  • Re: How do I work around lack of UNION in MySQL?Thimble Smith16 Mar
  • How do I work around lack of UNION in MySQL?Michael Widenius16 Mar
    • open_files limit?Brandon Pulsipher16 Mar
      • open_files limit?Michael Widenius16 Mar
      • Re: open_files limit?Matthias Pigulla17 Mar
RE: open_files limit?Robin Bowes17 Mar