icon Learn how to get the most out of Surmunity - read our forum tips here! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » an sql error on mysql5 after transfer from mysql4

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old March 18th, 2008, 3:58 AM   #1 (permalink)
Registered User
Seasoned Poster
 
Joined in Sep 2003
47 posts
Gave thanks: 4
Thanked 5 times
an sql error on mysql5 after transfer from mysql4

hello,
i have an sql sentence which was working on mysql 4.
SELECT p.*, e.title, u.user FROM photos p, records e
LEFT JOIN users u ON u.user=p.user
WHERE p.approved=1 AND e.id=p.id

but this sql sentence now gives error on mysql 5.
it says: Unknown column 'p.user' in 'on clause'
however there is a column named user on p table.

does anybody have any idea what might be causing the this?
thanks in advance
__________________
server: pass40
sascoms is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old March 18th, 2008, 4:27 AM   #2 (permalink)
Registered User
Seasoned Poster
 
Joined in Sep 2003
47 posts
Gave thanks: 4
Thanked 5 times
some google search with the error sentence gave the correct result here:
MySQL Bugs: #13551: #1054 - Unknown column 'xxxx' in 'on clause'

we need to put paranthesis around from tables and join expressions:
like below:
... FROM (table1, table2)
join ... ON (col1=col2)

incase anyone comes accross the same error.
__________________
server: pass40
sascoms is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
These users thank sascoms for this great post!
Mike (March 18th, 2008), ~ K ~ (April 11th, 2008)
Old April 11th, 2008, 11:27 PM   #3 (permalink)
Registered User
Seasoned Poster
 
Joined in Aug 2006
Hosted on Pass64
62 posts
Gave thanks: 9
Thanked 0 times
Thank you very much, sascoms! Of all the pages I read on fixing the "joins" syntax error, your simple explanation is how I found my way!
__________________
Pass64:
~ K ~ is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On