SELECT r.report_id,
a.advertisement_title,
COUNT(r.advertisement_id) AS total
FROM report r
JOIN advertisement a ON a.advertisement_id = r.advertisement_id
GROUP BY r.advertisement_id
答案 0 :(得分:1)
以下是如何做到的
$this->db->select('r.report_id,
a.advertisement_title,
COUNT(r.advertisement_id) AS total');
$this->db->from('report r');
$this->db->join('advertisement a','a.advertisement_id = r.advertisement_id');
$this->db->group_by('r.advertisement_id');
答案 1 :(得分:0)
$this->db->query('
SELECT r.report_id,
a.advertisement_title,
COUNT(r.advertisement_id) AS total
FROM report r
JOIN advertisement a ON a.advertisement_id = r.advertisement_id
GROUP BY r.advertisement_id')