From: Peter Brawley Date: April 13 2005 3:39am Subject: Re: LEFT JOINS same data twice? List-Archive: http://lists.mysql.com/mysql/182527 Message-Id: <425C947B.20003@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Chris, Sure, you can join a table multiple times. You're missing a FROM clause and you seem to put column names where table names or aliases ought to be. Is this ... SELECT tlb1.DepartureLocation AS Departure, tbl1.DepartureLocation AS Destination FROM tbl1 LEFT JOIN tbl2 ON tbl2.DepartureID=tlb1.LocationID LEFT JOIN tbl2 ON tbl2.ArrivalID=tbl1.LocationID ORDER BY tbl2.Time; what you mean? PB ----- Chris Knipe wrote: > Hi, > > Is it possible to left join the same data twice? > > TBL ONE: > LocationID > Location, varchar(100) > > TBL TWO: > DepartureID, > ArrivalID, > Time > > SELECT tlb1.DepartureLocation AS Departure, tbl1.DepartureLocation AS > Destination LEFT JOIN DepartureLocation ON > tlb2.DepartureID=tlb1.LocationID LEFT JOIN DepartureLocation ON > tbl2.ArrivalID=tbl1.LocationID ORDER BY tbl2.Time etc etc etc > > > I get > > ERROR 1066 (42000): Not unique table/alias: 'tbl1' > > > Thanks. > > > > -- > Chris. > > I love deadlines. I especially love the whooshing sound they make as > they fly by..." - Douglas Adams, 'Hitchhiker's Guide to the Galaxy' > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 4/12/2005