It is currently Wed Feb 08, 2012 5:50 pm

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Query Help with version difference.
PostPosted: Mon Feb 25, 2008 4:00 am 
Offline

Joined: Mon Feb 25, 2008 3:57 am
Posts: 2
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


Top
 Profile  
 
 Post subject: Found cause
PostPosted: Mon Feb 25, 2008 4:44 am 
Offline

Joined: Mon Feb 25, 2008 3:57 am
Posts: 2
***(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'


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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

Search for:
Jump to:  
cron