title: Custom select query wordpress order by meta key value
body: <p>I am trying to <code>ORDER BY</code> my results of a custom select query.</p>
  
  <p>But I am trying to order by the value of a meta key.</p>
  
  <p>Please see my query below...</p>
  
  <pre><code>$get_atts =  $wpdb-&gt;get_results("SELECT ID, post_title FROM $wpdb-&gt;posts WHERE $wpdb-&gt;posts.post_type IN ('individual') ORDER BY $wpdb-&gt;posts.meta_key = 'surname' ASC");
  </code></pre>
  
  <p>As you can see this <code>ORDER BY</code> is breaking it...</p>
  
  <pre><code>ORDER BY $wpdb-&gt;posts.meta_key = 'surname' ASC"
  </code></pre>
  
  <p>So I am trying to order by the value of <code>surname</code></p>
  
  <p>But my does not seem to work. Can any explain why or help?</p>