codeigniter-base-model icon indicating copy to clipboard operation
codeigniter-base-model copied to clipboard

How to do a GROUP_CONCAT while using this base model

Open dftz opened this issue 12 years ago • 0 comments
trafficstars

Getting all records and returning one row with field containing concatanated 'tags' field values. Here is how I do it with regular active record:

$this->db->select('GROUP_CONCAT(tags) as tags');
$this->db->from('articles');
$this->db->where("tags != ''");
$result = $this->db->get();

Would be nice not to have to specify the 'from' table. Is there a way to do that select with GROUP_CONCAT but still use this model's get methods?

dftz avatar Jan 21 '13 23:01 dftz