title: How to display user_nicename and usermeta values by custom query in Wordpress?
body: <p>I am trying to display user_nicename and one of usermeta values where meta_key is description. My query is given below:</p>
  
  <pre><code>&lt;?php
  $querystr = "
          SELECT * 
          FROM $wpdb-&gt;users, $wpdb-&gt;usermeta
          WHERE $wpdb-&gt;users.ID = $wpdb-&gt;usermeta.user_id 
          AND $wpdb-&gt;usrmeta.meta_key = 'description' 
       ";
  
  $retrieve_data = $wpdb-&gt;get_results($querystr, OBJECT);
  
  ?&gt;
  
  &lt;?php global $retrieved_data; foreach ($retrieve_data as $retrieved_data){ ?&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Customer Name&lt;/th&gt;
          &lt;th&gt;Customer Details&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $retrieved_data-&gt;user_nicename;?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $retrieved_data-&gt;meta_value;?&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;?php } ?&gt;
  </code></pre>
  
  <p>My final output should be displayed inside a table which will look something like below:
  <a href="https://i.stack.imgur.com/mZHD5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mZHD5.jpg" alt="enter image description here"></a></p>
  
  <p>But I am in confusion how to do that. I am facing problem for both sql syntax and displaying data inside the table. Sorry for this easy question, I am still a learner. Can anyone help me in here? Thanks</p>