title: How to inner join from another table and order by specific row value?
body: <p>In WordPress, there are 2 tables: wp_terms and wp_termmeta.</p>
  
  <p>I currently do the following to get the terms and parents etc:</p>
  
  <pre><code>$query = mysqli_query($mysqli, "
  SELECT wp_terms.term_id,wp_terms.name, wp_term_taxonomy.parent
  FROM wp_terms INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id
  WHERE wp_term_taxonomy.taxonomy = 'post-categories'
  ORDER BY name"); 
  </code></pre>
  
  <p>However - I need to access the wp_termmeta table, select a row where the term_id is the same and the meta_key is "order" then order by the meta_value of the wp_termmeta, instead of name as it is currently.</p>
  
  <p>How would I do that with the current query?</p>