Select, count and where using codeigniter and mysql

前端 未结 4 1150
被撕碎了的回忆
被撕碎了的回忆 2021-01-12 07:31

I have two table as follow:

- tblSaler

    SalerID  |  SalerName | 
    ----------------------|
    1        |  sothorn   |
    ----------------------|
            


        
4条回答
  •  生来不讨喜
    2021-01-12 08:29

    Try This

    $this->db->select('SalerName, count(*)'); 
    $this->db->from('tblSaler'); 
    $this->db->join('tblProduct', 'tblSaler.SalerID = tblProduct.SalerID');
    $this->db->group('SalerID');
    

提交回复
热议问题