Is it possible to join dynamic tables (subqueries) using db_select()?
Both db_select and addJoin documentation says clearly that the table


  May be a string or another SelectQuery object. If a query object is passed, it will be used as a subselect.


So, 

$sub_select = db_select('comment');
// Convert.
$select = db_select('comment')-&gt;addJoin($sub_select...