MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Monique Date:November 6 2004 11:16pm
Subject:RE: Advanced SELECT Syntax Help Needed!
View as plain text  
Thank you Frederic!  It worked perfectly!!!  I didn't know you could have
several joins linked together!


-----Original Message-----
From: Frederic Wenzel [mailto:freeed@stripped] 
Sent: Saturday, November 06, 2004 3:56 AM
To: Rhino
Cc: Monique; mysql@stripped
Subject: Re: Advanced SELECT Syntax Help Needed!

On Fri, 5 Nov 2004 17:49:29 -0500, Rhino <rhino1@stripped> wrote:
> I'm not sure why you want to use a subquery; if MySQL is anything like
> a join usually performs better than a subquery and the optimizer converts
> subquery to a join ("under the covers") whenever it can anyway. Therefore,
> how about something like:
> select id, name, linkname1, linkname2
> from main m right outer join links1 l1 on =
> right outer join links l2 on =;

Yes, indeed joins usually perform better than subselects.
I agree to your suggested query, but I think we ought to use LEFT
joins here rather than RIGHT joins because Monique wants to receive
any main record regardless of the existence of corresponding "links".

So the query I would use is:

SELECT, l1.linkname1, l2.linkname2
FROM main m LEFT JOIN links1 l1 ON ( =
LEFT JOIN links2 l2 ON ( =;

Please let us know if it worked, Monique.


MySQL General Mailing List
For list archives:
To unsubscribe:

Advanced SELECT Syntax Help Needed!Monique5 Nov
  • Re: Advanced SELECT Syntax Help Needed!Rhino5 Nov
    • Re: Advanced SELECT Syntax Help Needed!Frederic Wenzel6 Nov
      • RE: Advanced SELECT Syntax Help Needed!Monique7 Nov