Advanced WordPress SQL Query

In WP, you rarely need to “write SQL queries”, unless you work with custom tables, instead use its API…

WP_User_Query will join for you all meta data attached to each user and return to you plain user objects, so why not use it instead?

Also, see get_user_meta()