title: How can I count how many duplicates there are for each distinct value in sqlite?
body: <p>I have a table:</p>
  
  <pre><code>ref,type
  1,red
  2,red
  3,green
  4,blue
  5,black
  6,black
  </code></pre>
  
  <p>I want the result of a sqlite query to be:</p>
  
  <pre><code>red,2
  green,1
  blue,1
  black,2
  </code></pre>
  
  <p>I think the hardest thing to do is find a question to match my problem?  Then I am sure the answer is around the corner....</p>
  
  <p>:)</p>