From: Peter Brawley Date: October 11 2006 6:12pm Subject: Re: moving to other web server List-Archive: http://lists.mysql.com/mysql/202550 Message-Id: <452D33F0.7060207@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=======AVGMAIL-452D33F17FA8=======" --=======AVGMAIL-452D33F17FA8======= Content-Type: multipart/alternative; boundary=------------010901090503000502020906 --------------010901090503000502020906 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit >Still don't get it Did you read the section of that manual page headed "Join processing changes in MySQL 5.0.12"? It explains why and how to rewrite all such queries using explicit JOIN ... ON | USING syntax. PB ----- afan@stripped wrote: > Still don't get it > :( > > > > >> Hi, >> >> Take a look at the answer written by Peter Brawley to Jason Chan at Oct >> 10, 2006, ~04:34 PM. Answer included below: >> >> >>> Jason >>> >>> following statement works in 4 but not 5 >>> >>> SELECT f.*, c.id as cat_id, c.position as cat_position, c.state as >>> cat_state, c.name as cat_name, c.description as cat_desc, >>> c.image, c.url, m.member_name as mod_name, m.member_id as >>> mod_id, m.is_group, m.group_id, m.group_name, m.mid >>> FROM ibf_forums f, ibf_categories c >>> LEFT JOIN ibf_moderators m ON (f.id=m.forum_id) >>> WHERE c.id=f.category >>> ORDER BY c.position, f.position >>> >>> Look up joins in the 5.0 or 5.1 manual. As of 5.0.12, MySQL implemented >>> ANSI/ISO compliance, breaking comma joins of the sort you use above. You >>> need explicit JOIN ... ON | USING syntax to remove referential >>> ambiguities. >>> >>> PB >>> >>> ----- >>> >>> Jason Chan wrote: >>> >>> >>>> I am going to upgrade my database from version 4 to 5. >>>> However I found some of my web application doesn't work on MySQL5 >>>> >>>> e.g following statement works in 4 but not 5 >>>> >>>> SELECT f.*, c.id as cat_id, c.position as cat_position, c.state as >>>> cat_state, c.name as cat_name, c.description as cat_desc, >>>> c.image, c.url, m.member_name as mod_name, m.member_id as >>>> mod_id, m.is_group, m.group_id, m.group_name, m.mid >>>> FROM ibf_forums f, ibf_categories c >>>> LEFT JOIN ibf_moderators m ON (f.id=m.forum_id) >>>> WHERE c.id=f.category >>>> ORDER BY c.position, f.position >>>> >>>> Error: >>>> Unknown column 'f.id' in 'on clause' >>>> >>>> The alias seem not working? >>>> What should I do, I dont want to rewrite all my sql statement.... >>>> >>>> Thanks. >>>> >>>> Jason >>>> >>>> >>>> >> -- >> Anders Lundgren >> Master Software Engineer >> Viba IT Handelsbolag >> Web: http://www.vibait.se >> >> >> afan@stripped wrote: >> >>> hi, >>> currently using mysql 4.0.18. want to move to 5.0 (latest stable version >>> for commercil use). is there anytihng I have to be considered DB will >>> not >>> work? >>> >>> thanks. >>> >>> -afan >>> >>> >>> >>> >>> > > > --------------010901090503000502020906 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
>Still don't get itDid you read the section of that manual page headed "Join processing changes in MySQL 5.0.12"? It explains why and how to rewrite all such queries using explicit JOIN ... ON | USING syntax.
--------------010901090503000502020906-- --=======AVGMAIL-452D33F17FA8======= Content-Type: text/plain; x-avg=cert; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: "AVG certification" No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.408 / Virus Database: 268.13.2/471 - Release Date: 10/10/2006 --=======AVGMAIL-452D33F17FA8=======--Still don't get it :(Hi, Take a look at the answer written by Peter Brawley to Jason Chan at Oct 10, 2006, ~04:34 PM. Answer included below:Jason following statement works in 4 but not 5 SELECT f.*, c.id as cat_id, c.position as cat_position, c.state as cat_state, c.name as cat_name, c.description as cat_desc, c.image, c.url, m.member_name as mod_name, m.member_id as mod_id, m.is_group, m.group_id, m.group_name, m.mid FROM ibf_forums f, ibf_categories c LEFT JOIN ibf_moderators m ON (f.id=m.forum_id) WHERE c.id=f.category ORDER BY c.position, f.position Look up joins in the 5.0 or 5.1 manual. As of 5.0.12, MySQL implemented ANSI/ISO compliance, breaking comma joins of the sort you use above. You need explicit JOIN ... ON | USING syntax to remove referential ambiguities. PB ----- Jason Chan wrote:I am going to upgrade my database from version 4 to 5. However I found some of my web application doesn't work on MySQL5 e.g following statement works in 4 but not 5 SELECT f.*, c.id as cat_id, c.position as cat_position, c.state as cat_state, c.name as cat_name, c.description as cat_desc, c.image, c.url, m.member_name as mod_name, m.member_id as mod_id, m.is_group, m.group_id, m.group_name, m.mid FROM ibf_forums f, ibf_categories c LEFT JOIN ibf_moderators m ON (f.id=m.forum_id) WHERE c.id=f.category ORDER BY c.position, f.position Error: Unknown column 'f.id' in 'on clause' The alias seem not working? What should I do, I dont want to rewrite all my sql statement.... Thanks. Jason-- Anders Lundgren Master Software Engineer Viba IT Handelsbolag Web: http://www.vibait.se afan@stripped wrote:hi, currently using mysql 4.0.18. want to move to 5.0 (latest stable version for commercil use). is there anytihng I have to be considered DB will not work? thanks. -afan