I have two table as follow:
- tblSaler SalerID | SalerName | ----------------------| 1 | sothorn | ----------------------|
Try This
$this->db->select('SalerName, count(*)'); $this->db->from('tblSaler'); $this->db->join('tblProduct', 'tblSaler.SalerID = tblProduct.SalerID'); $this->db->group('SalerID');