MYSQL GROUP BY/COUNT with condition
<p>I wish to extend a simple 'GROUP/COUNT BY' query with a condition that only takes a certain number of rows, according to criteria.</p>

<p>Here is a simple table. A normal 'GROUP BY' would count and return the full quantity of rows, but i'd need to extend my query with the statements seen beside the table:</p>

<pre>
+-----+----------+----------+-------+
| id  | deleted  | status   |  ref  |
+-----+----------+----------+-------+
|   1 |        0 | paid     | 10001 |
|   2 |        0 | paid     | 10001 |
|   3 |        0 | paid     | 10001 |   WHERE status = paid ABD id IN (2,3) //COUNT = 2
|   4 |        0 | paid     | 10002 |
|   5 |        1 | cat      | 10002 |
|   6 |        1 | cat      | 10002 |   WHERE status = cat AND id IN (6) //COUNT = 1
|   7 |        0 | cat      | 10003 |
|  12 |        0 | pending  | 10004 |
|  13 |        1 | pending  | 10005 |
|  14 |        1 | pending  | 10005 |
|  15 |        1 | pending  | 10005 |   WHERE status = pending AND id IN(12,14,17) COUNT = 3
|  16 |        0 | pending  | 10005 |
|  17 |        0 | pending  | 10006 |
|  18 |        0 | pending  | 10006 |
|  19 |        0 | pending  | 10006 |
+-----+----------+----------+-------+
</pre>

<p>What's the simplest way to get the desired results seen below with the conditions outlined above? </p>

<pre>
+----------+---------+
| status   |  COUNT  |
+----------+---------+
| paid     | 2       |
| cat      | 1       |
| pending  | 3       | 
+----------+---------+
</pre>