title: IFNULL(COUNT('id'),0) in Codeigniter
body: <p>I believe there is an error in this line in Codeigniter using Active Records, but I  cant seem to figure out the syntax on the second line with IFNULL() and COUNT()</p>
  
  <pre><code>$this-&gt;db-&gt;select('places.*, category.*')
              -&gt;select('IFNULL(COUNT("places_reviews.place_id"), 0) AS num_reviews')
              -&gt;from('places')
              -&gt;join('category', 'places.category_id = category.category_id')
              -&gt;join('places_reviews', 'places_reviews.place_id = places.id', 'left')
              -&gt;where('places.category_id', $category_id)
              -&gt;group_by('places.id')
              -&gt;limit($limit, $offset)
              -&gt;order_by($sort_by, $sort_order);
  </code></pre>