 <p>I need to see the full query, but at a guess it is going to be:</p> <pre><code>LEFT JOIN adcfvc ON adcfvc.advert_id = $table.id </code></pre> <p>Where $table is the tablename of the first table.</p>