title: get data by left join with count() for each row
body: <p>My code:</p>
  
  <pre><code>$q = mysql_query("
              SELECT 
                  ads.title_ad AS title_ad, 
                  COUNT(adclicks.ad_id) AS counted, 
                  ads.dclicks AS dclicks
              FROM ads
              LEFT JOIN adclicks 
                  ON ads.id = adclicks.ad_id GROUP BY ads.id
      ");
  
  while($row = mysql_fetch_array($q))
  {
      if($row['counted'] &gt; $row['dclicks'])
      {
      }
      else
      {
          echo ''.$row['title_ad'].' '.$row['counted'].' '.$row['dclicks'].'&lt;br&gt;';
      }
  }
  </code></pre>
  
  <p>I just want to remove <code>if(){}</code> and want to adjust it in sql query.</p>
  
  <p>Whats the  solution? How to do that?</p>