[wp-hackers] RE: wp-hackers Digest, Vol 36, Issue 31
Mike Walsh
mike_walsh at mindspring.com
Mon Jan 14 17:36:33 GMT 2008
Thanks very much, this is exactly what I was trying to do, it works
perfectly. Apparently I need to brush up on my SQL!
Mike
-----Original Message-----
Message: 5
Date: Mon, 14 Jan 2008 16:25:35 +1100
From: DD32 <wordpress at dd32.id.au>
Subject: Re: [wp-hackers] User Meta Query Assistance
To: wp-hackers at lists.automattic.com
Message-ID: <op.t4wmoxfdk6w4mc at dd32.no-ip.com>
Content-Type: text/plain; charset=iso-8859-15
This works for me:
SELECT ID, user_login, fname, lname
FROM `wp_users`
LEFT JOIN (
SELECT user_id AS uid, meta_value AS fname
FROM `wp_usermeta`
WHERE meta_key = 'first_name'
) AS metaF ON wp_users.ID = metaF.uid
LEFT JOIN (
SELECT user_id AS uid, meta_value AS lname
FROM `wp_usermeta`
WHERE meta_key = 'last_name'
) AS metaL ON wp_users.ID = metaL.uid
returns:
ID user_login fname lname
----------------------------------------
1 admin NULL NameHere
2 DD32 Dion NULL
3 VerminUser Ask B
4 low First Last
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers
End of wp-hackers Digest, Vol 36, Issue 31
******************************************
More information about the wp-hackers
mailing list