I'm not sure why you want to use a subquery; if MySQL is anything like DB2, a join usually performs better than a subquery and the optimizer converts a 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 m.id = l1.id right outer join links l2 on m.id = l2.id; I haven't tested it but it ought to work. Rhino ----- Original Message ----- From: "Monique" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 05, 2004 4:59 PM Subject: Advanced SELECT Syntax Help Needed! Hi! I would love some help with my syntax (or another strategy). I keep bombing. I've simplified it. Here is the deal: Three files: Main: id, name Links1: id, linkname1 (a record may or may not exist for each record in Main) Links2: id, linkname2 (a record may or may not exist for each record in Main) I need a list of every record in main plus linkname1 and linkname2. I am trying to use a subquery. SELECT name, linkname2, links1.id, links1.linkname1 FROM (SELECT main.id, main.name, links2.linkname2 from main LEFT OUTER JOIN links2 using (id)) AS subfile LEFT OUTER JOIN links1 using (id) I keep getting syntax errors. I would really appreciate any input. Thanks a bunch -- Monique. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]