List:General Discussion« Previous MessageNext Message »
From:Nobody Date:November 20 2003 2:40pm
Subject:[SOLVED]Re: LEFT JOIN problem
View as plain text  
Thanks Roger

That fixed the problem.....I was under the impression that I only had to put
the linked columns n the ON and everything else in the WHERE....live an
learn I guess.


Rory McKinley
Nebula Solutions
+27 82 857 2391
rorym@stripped
"There are 10 kinds of people in this world,
those who understand binary and those who don't" (Unknown)
----- Original Message ----- 
From: "Roger Baklund" <roger@stripped>
To: <mysql@stripped>
Cc: "Rory McKinley" <rorym@stripped>
Sent: Thursday, November 20, 2003 4:23 PM
Subject: Re: LEFT JOIN problem


> * Rory McKinley
> [...]
> > SELECT a.line_number, a.category_value, IFNULL(b.parameter_trigger, 0)
> > FROM DB1.Table 1 AS a LEFT JOIN DB2.Table 2 AS b ON
> > a.category_name = b.parameter_value
> > WHERE a.line_type = 13 AND b.parameter_ID = 13
> >
> > The only problem is that the query only returns the first two
> > records and not the third record - contrary to my expectations. I
> > am using MySQL 4.0.15-standard together with PHPMyAdmin 2.5.3.
> >
> > Does anybody know what I am doing wrong?
>
> You have a criteria on the B table in the WHERE clause. Move it to the ON
> clause:
>
> SELECT ... AS b ON
>     a.category_name = b.parameter_value AND
>     b.parameter_ID = 13
>   WHERE a.line_type = 13
>
> --
> Roger
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
>

Thread
LEFT JOIN problemRory McKinley20 Nov
  • Re: LEFT JOIN problemRoger Baklund20 Nov
    • [SOLVED]Re: LEFT JOIN problemNobody20 Nov
    • Re: [SOLVED]Re: LEFT JOIN problemMartijn Tonies20 Nov
      • Re: [SOLVED]Re: LEFT JOIN problemRoger Baklund20 Nov
        • Re: [SOLVED]Re: LEFT JOIN problemMartijn Tonies20 Nov
          • Re: [SOLVED]Re: LEFT JOIN problemRoger Baklund20 Nov
        • Re: [SOLVED]Re: LEFT JOIN problemMartijn Tonies20 Nov