List:General Discussion« Previous MessageNext Message »
From:Rhino Date:April 13 2005 3:41am
Subject:Re: LEFT JOINS same data twice?
View as plain text  
I haven't actually tried left-joining the same tables multiple times in
MySQL but I'm almost certain it should work in principle.

However, the syntax of your query is definitely wrong. At the very least,
you need the word 'FROM' to designate which tables you are joining. The
manual has examples of some joins; look at them for the exact syntax.

Rhino

----- Original Message ----- 
From: "Chris Knipe" <savage@stripped>
To: <mysql@stripped>
Sent: Tuesday, April 12, 2005 11:01 PM
Subject: LEFT JOINS same data twice?


> 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'
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 12/04/2005
>
>



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 12/04/2005

Thread
LEFT JOINS same data twice?Chris Knipe13 Apr
  • Re: LEFT JOINS same data twice?Peter Brawley13 Apr
  • Re: LEFT JOINS same data twice?Rhino13 Apr
  • Re: LEFT JOINS same data twice?Roger Baklund13 Apr
  • Re: LEFT JOINS same data twice?Chris Knipe15 Apr
    • Re: LEFT JOINS same data twice?SGreen15 Apr
      • Re: LEFT JOINS same data twice?Peter Brawley15 Apr
      • Re: LEFT JOINS same data twice?Chris Knipe15 Apr
        • Re: LEFT JOINS same data twice?SGreen15 Apr
          • Re: LEFT JOINS same data twice?SGreen15 Apr