title: How to count the number of rows with specific data in mssql
body: <p>I have the following table:</p>
  
  <p>Items:</p>
  
  <pre><code>ID     Type     StockExists  
  01     Cellphone   T
  02     Cellphone   F
  03     Apparrel    T
  </code></pre>
  
  <p>I want to <code>count the number of items</code> with existing stocks, i.e., the number of rows with <code>StockExists='T'</code>. I was performing the query as;</p>
  
  <pre><code>Select count(StockExists) 
  From [Items] where StockExists='T'
  </code></pre>
  
  <p>but it is always returning 1. What is the right way to do it?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Also, how to perform another such Count operation and add them together in one row, for example, </p>
  
  <pre><code>Select count(StockExists) 
  From [Items] where StockExists='T'` and `Select count(Type) 
  From [Items] where Type='Cellphone'` ? 
  </code></pre>