title: Select, count and where using codeigniter and mysql
body: <p>I have two table as follow: </p>
  
  <pre><code>- tblSaler
  
      SalerID  |  SalerName | 
      ----------------------|
      1        |  sothorn   |
      ----------------------|
      2        |  Daly      |  
      ----------------------|
      3        |  Lyhong    |
      ----------------------|
      4        | Chantra    |
      ----------------------|
  
  - tblProduct
  
  ProductID  | Product  | SalerID |
  --------------------------------|
  1          | Pen      | 3       |
  --------------------------------|
  2          | Book     | 2       |
  --------------------------------|
  3          | Phone    | 3       |
  --------------------------------|
  4          | Computer | 1       |
  --------------------------------|
  5          | Bag      | 3       |
  --------------------------------|
  6          | Watch    | 2       |
  --------------------------------|
  7          | Glasses  | 4       |
  --------------------------------|
  </code></pre>
  
  <p>The result that I need is:</p>
  
  <pre><code>sothorn | 1
  Daly    | 2
  Lyhong  | 3
  Chantra | 1
  </code></pre>
  
  <p>I have tried this : </p>
  
  <pre><code>    $this-&gt;db-&gt;select('count(SalerName) as sothorn where tblSaler.SalerID = 1, count(SalerName) as Daly where tblSaler.SalerID = 2, count(SalerName) as Lyhong where tblSaler.SalerID = 3, count(SalerName) as Chantra where tblSaler.SalerID = 4');
      $this-&gt;db-&gt;from('tblSaler');
      $this-&gt;db-&gt;join('tblProduct', 'tblSaler.SalerID = tblProduct.SalerID');
  </code></pre>