title: MYSQL Multiple Table
body: <p>I want to use multiple table to get recent post (Q) and user name (handle) but when I am trying to get with this code it is giving error</p>
  
  <p>Table Name <strong>qa_posts</strong> and <strong>qa_users</strong> and need to connect <strong>userid</strong> from <strong>qa_posts</strong> to <strong>handle</strong> from <strong>qa_users</strong></p>
  
  <pre><code>SELECT *
  FROM qa_posts, qa_users
  WHERE type="Q" AND qa_posts.userid = "qa_users.handle"
  ORDER BY created DESC
  LIMIT 5
  </code></pre>
  
  <p><strong>Error message</strong></p>
  
  <pre><code>SELECT *
  FROM qa_posts, qa_users
  WHERE qa_posts.userid = "qa_users.handle"
  ORDER BY created DESC
  LIMIT 5
  
  Error 1052: Column 'created' in order clause is ambiguous
  </code></pre>
  
  <p><strong>Actual Code</strong></p>
  
  <pre><code>qa_db_connection();
  $query_post = qa_db_query_raw('         
      SELECT *
      FROM qa_posts, qa_users
      WHERE type="Q" AND qa_posts.userid = "qa_users.handle"
      ORDER BY created DESC
      LIMIT 5
  
  ') or die(mysql_error());
  
  while($row = mysql_fetch_array($query_post)) {
      echo $row['title'];
      echo '&lt;span style="font-size:65%;font-style:italic"&gt;'.$row['created'].'&lt;/span&gt;';
      echo '&lt;br/&gt;';
  }
  </code></pre>
  
  <p>See this image for table structure
  <img src="https://i.stack.imgur.com/IgQhH.jpg" alt="Table Strucute"></p>