I have table like this :
+-------------------+-------------+
| Items | Status |
+-------------------+-------------+
| 001 | Good |
| 001 | Bad |
| 001 | Good |
| 002 | Good |
+-------------------+-------------+
and I want to have output like this :
+-------------------+-------------+-------+
| Items | Status | Count |
+-------------------+-------------+-------+
| 001 | Good | 2 |
| 001 | Bad | 1 |
| 002 | Good | 1 |
+-------------------+-------------+-------+
how to Group and Count table like that? that’s all I need. thank you.
UPDATE :
I just realize that by having that output, I will have same rows on Items column. What if I want an output like this :
+-------------------+------+------+
| Items | Bad | Good |
+-------------------+------+------+
| 001 | 2 | 1 |
| 002 | 0 | 1 |
+-------------------+------+------+
is it possible doing it with MySQL? thanks.
Try this: