[wp-hackers] User Meta Query Assistance

Otto otto at ottodestruct.com
Tue Jan 15 21:53:17 GMT 2008


Haven't tried it, but wouldn't this work without a subselect?

SELECT ID, user_login, first.meta_value AS fname, last.meta_value AS lname
FROM wp_users
LEFT JOIN wp_usermeta AS first ON
(wp_users.ID = first.ID AND
first.meta_key = 'first_name')
LEFT JOIN wp_usermeta AS last ON
(wp_users.ID = last.ID AND
last.meta_key = 'last_name')


More information about the wp-hackers mailing list