title: SQL: Chaining Joins Efficiency
body: <p>I have a query in my WordPress plugin like this:</p>
  
  <pre><code>SELECT users.*, U.`meta_value` AS first_name,M.`meta_value` AS last_name 
      FROM `nwp_users` AS users 
          LEFT JOIN `nwp_usermeta` U 
              ON users.`ID`=U.`user_id` 
          LEFT JOIN `nwp_usermeta` M 
              ON users.`ID`=M.`user_id` 
          LEFT JOIN `nwp_usermeta` C 
              ON users.`ID`=C.`user_id` 
      WHERE U.meta_key = 'first_name' 
          AND M.meta_key = 'last_name' 
          AND C.meta_key = 'nwp_capabilities' 
      ORDER BY users.`user_login` ASC 
      LIMIT 0,10
  </code></pre>
  
  <p>I'm new to using <code>JOIN</code> and I'm wondering how efficient it is to use so many <code>JOIN</code> in one query. Is it better to split it up into multiple queries?</p>
  
  <p><a href="http://codex.wordpress.org/Database_Description#Table%3a_wp_users" rel="nofollow">The database schema can be found here.</a></p>