mysql syntax how to add a third table to $query
- by IberoMedia
I have 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 <= {$aid}"
." AND a.trash = 0"
." AND c.published = 1"
." AND c.access <= {$aid}"
." AND c.trash = 0"
;
I would like to add a third table ('__some_table') for the parts of the query where a.publish, a.access and a.trash. In other words, I want these fields to be retrieved from another table, not "#__table_one", but I do not know how to incorporate the #__some_table into the current query
I imagine the JOIN command can help me, but I do not know how to code mysql
Thank you,