[wp-hackers] User Meta Query Assistance

Brian Layman Brian at thecodecave.com
Wed Jan 16 02:30:02 GMT 2008


With some minor tweaks, yes...

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.user_id
AND first.meta_key = 'first_name') LEFT JOIN wp_usermeta AS last ON
(wp_users.ID = last.user_id AND last.meta_key = 'last_name') 

Nice use of sequential joins!

______________________________________________
Brian Layman
b5media Inc.
www.b5Media.com / www.TheCodeCave.com
Skype: BrianLayman
Twitter: http://www.twitter.com/brianlayman







More information about the wp-hackers mailing list