|
It is currently Wed Feb 08, 2012 5:50 pm
|
View unanswered posts | View active topics
|
Page 1 of 1
|
[ 2 posts ] |
|
| Author |
Message |
|
phibertek
|
Post subject: Query Help with version difference. Posted: Mon Feb 25, 2008 4:00 am |
|
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 |
|
 |
|
phibertek
|
Post subject: Found cause Posted: Mon Feb 25, 2008 4:44 am |
|
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 |
|
 |
|
Page 1 of 1
|
[ 2 posts ] |
|
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
|
|