PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



Query Help with version difference.

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> MySQL General
View previous topic :: View next topic  
Author Message
phibertek



Joined: 25 Feb 2008
Posts: 2

PostPosted: Mon Feb 25, 2008 3:00 am    Post subject: Query Help with version difference. Reply with quote

Hello, I have this query that worked on MySQL version 4.1.20, but when I moved to 5.0.22, the query bombs.

SELECT DISTINCT id,users.user_login as username,
meta_first.meta_value as firstname,
meta_last.meta_value as lastname,
users.user_pass as password,
users.user_nicename,
users.user_email as email,
users.user_url as url
FROM users,usermeta
INNER
JOIN usermeta as meta_first
ON meta_first.user_id = users.id
AND meta_first.meta_key = 'first_name'
INNER
JOIN usermeta as meta_last
ON meta_last.user_id = users.id
AND meta_last.meta_key = 'last_name'
WHERE users.user_login = 'markw'
AND usermeta.meta_key = 'last_name'

ERROR 1054 (42S22): Unknown column 'users.id' in 'on clause'

Can someone shed some light on this for me?

-Mark
Back to top
View user's profile Send private message
phibertek



Joined: 25 Feb 2008
Posts: 2

PostPosted: Mon Feb 25, 2008 3:44 am    Post subject: Found cause Reply with quote

***(users as users ,usermeta as usermeta)***
I guess they are making MySQL more compliant.


SELECT DISTINCT id,users.user_login as username,
meta_first.meta_value as firstname,
meta_last.meta_value as lastname,
users.user_pass as password,
users.user_nicename,
users.user_email as email,
users.user_url as url
FROM (users as users ,usermeta as usermeta)
INNER
JOIN usermeta as meta_first
ON meta_first.user_id = users.id
AND meta_first.meta_key = 'first_name'
INNER
JOIN usermeta as meta_last
ON meta_last.user_id = users.id
AND meta_last.meta_key = 'last_name'
WHERE users.user_login = 'markw'
AND usermeta.meta_key = 'last_name'
Back to top
View user's profile Send private message
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



Post new topic   Reply to topic    WeberForums.com Forum Index -> MySQL General All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum






Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum