From: Martijn Tonies Date: November 20 2003 2:45pm Subject: Re: [SOLVED]Re: LEFT JOIN problem List-Archive: http://lists.mysql.com/mysql/154220 Message-Id: <053201c3af74$e0066b10$0e02a8c0@martijn> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > 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. Ehm, I'm not completely sure, but isn't this invalid behaviour? Can you post the DDL and INSERT INTO data for these tables? With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL Server. Upscene Productions http://www.upscene.com > > * 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