title: mysql syntax how to add a third table to $query
body: <p>I have code:</p>
  
  <pre><code>$query = "SELECT a.*, c.name as categoryname, c.id as categoryid
            FROM #__table_one as a
            LEFT JOIN #__table_two c ON c.id = a.catid";
  
  $query .= " WHERE a.published = 1
              AND a.access &lt;= {$aid}
              AND a.trash = 0
              AND c.published = 
              AND c.access &lt;= {$aid}
              AND c.trash = 0";
  </code></pre>
  
  <p>I would like to add a third table (<strong>'__some_table'</strong>) for the parts of the query where <strong>a.publish, a.access and a.trash</strong>. In other words, I want these fields to be retrieved from another table, not "<strong>#__table_one</strong>", but I do not know how to incorporate the <strong>#__some_table</strong> into the current query</p>
  
  <p>I imagine the <strong>JOIN</strong> command can help me, but I do not know how to code mysql</p>