Unix Technical Forum

MySQL 5 upgrade

This is a discussion on MySQL 5 upgrade within the MySQL forums, part of the Database Server Software category; --> Hi all, I've just moved my development server to FC5 which includes MySQL 5. Everything is fine in my ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:45 AM
huwpioden@gmail.com
 
Posts: n/a
Default MySQL 5 upgrade

Hi all,

I've just moved my development server to FC5 which includes MySQL 5.
Everything is fine in my old apps except this one query!!

SELECT DISTINCT n.nav_order,
n.cat_id,
IF((LENGTH(c.category) > 0),c.category,s.title) as
title,
IF((LENGTH(c.category) > 0),'',n.page_id) as page_id
FROM navigation n,
story s
LEFT JOIN categories c ON c.cat_id = n.cat_id
WHERE nav_order IS NOT NULL AND
n.page_id = s.page_uid
ORDER BY nav_order

It used to work just fine but now it get the following error:
Couldn't execute navigation query.Unknown column 'n.cat_id' in 'on
clause'

Any ideas what's wrong?

TIA

Huw

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 07:45 AM
Paul Lautman
 
Posts: n/a
Default Re: MySQL 5 upgrade

huwpioden@gmail.com wrote:
> Hi all,
>
> I've just moved my development server to FC5 which includes MySQL 5.
> Everything is fine in my old apps except this one query!!
>
> SELECT DISTINCT n.nav_order,
> n.cat_id,
> IF((LENGTH(c.category) > 0),c.category,s.title) as
> title,
> IF((LENGTH(c.category) > 0),'',n.page_id) as page_id
> FROM navigation n,
> story s
> LEFT JOIN categories c ON c.cat_id = n.cat_id
> WHERE nav_order IS NOT NULL AND
> n.page_id = s.page_uid
> ORDER BY nav_order
>
> It used to work just fine but now it get the following error:
> Couldn't execute navigation query.Unknown column 'n.cat_id' in 'on
> clause'
>
> Any ideas what's wrong?
>
> TIA
>
> Huw


Try bracketing the FROM tables thus
FROM (navigation n,
story s)
LEFT JOIN


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 07:45 AM
PFG
 
Posts: n/a
Default Re: MySQL 5 upgrade

On Tue, 30 May 2006 19:14:07 +0100, "Paul Lautman"
<paul.lautman@btinternet.com> wrote:

>huwpioden@gmail.com wrote:


(...)
>> FROM navigation n,
>> story s

(...)

>Try bracketing the FROM tables thus
>FROM (navigation n,
> story s)
> LEFT JOIN


....or say

FROM navigation AS n, story
--
Paweł
twierdza konserwy polskiej fizyki
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 07:46 AM
Bill Karwin
 
Posts: n/a
Default Re: MySQL 5 upgrade

huwpioden@gmail.com wrote:
> FROM navigation n,
> story s
> LEFT JOIN categories c ON c.cat_id = n.cat_id


MySQL 5.0.12 changed the precedence of comma-style joins vs. JOIN
syntax. Read more about that under the heading "Join Processing Changes
in MySQL 5.0.12" on this page:
http://dev.mysql.com/doc/refman/5.0/en/join.html

Anyway, it's better to use JOIN syntax throughout, for better
readability and predictable results:

FROM navigation n,
JOIN story s ON n.page_id = s.page_uid
LEFT JOIN categories c ON c.cat_id = n.cat_id

Regards,
Bill K.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 07:46 AM
PFG
 
Posts: n/a
Default Re: MySQL 5 upgrade

On Tue, 30 May 2006 20:27:32 +0200, PFG
<gora@notthispart.if.uj.edu.pl> wrote:

>On Tue, 30 May 2006 19:14:07 +0100, "Paul Lautman"
><paul.lautman@btinternet.com> wrote:
>
>>huwpioden@gmail.com wrote:

>
>(...)
>>> FROM navigation n,
>>> story s

>(...)
>
>>Try bracketing the FROM tables thus
>>FROM (navigation n,
>> story s)
>> LEFT JOIN

>
>...or say
>
>FROM navigation AS n, story


Oops, a fragmented post. What I intended to say was:

.... or say

FROM navigation AS n, story AS s
LEFT JOIN
etc

--
Pawel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:30 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com