Sub selection in db_select selectQuery
I just found out that you can add a db_select as a table into the left join. So the solution for this will be:

$subselect = db_select('og_membership', 'ogmk');
$subselect-&gt;join('node', 'kompas', "kompas.nid=ogmk.etid AND kompas.type='kompas'");
$subselect-&gt;join('publication_date', 'pd', 'pd.nid=kompas.nid');
$subselect-&gt;condition('pd.published_at', $end, '&lt;');
$subselect-&gt;condition('pd.published_at', $start, '&gt;');
$subselect-&gt;condition('kompas.status', 1, '=');
$subselect-&gt;fields('ogmk', array('gid', 'etid'));


$select-&gt;leftJoin($subselect, 'ogm_kompas', 'ogm_kompas.gid=og.gid');