I'm having trouble to convert the below SQL query into CodeIgniter query builder:
$row = $db->prepare("SELECT DATE(message_timestamp) Date, COUNT(DISTINCT messageid) totalCount FROM ic_deliveryreceipts GROUP BY DATE(message_timestamp)");
This is the latest I've tried:
$this->db->select(DATE(message_timestamp) as 'Date', COUNT(DISTINCT messageid) as 'totalCount');
$this->db->group_by(DATE(message_timestamp));
$query = $this->db->get($this->ic_receipts);
but this give a parse error:
syntax error, unexpected 'as' (T_AS), expecting ')'