I'm new to SQL. I need SQL query to achieve the mentioned output. I have asked a similar query but that doesn't describe my problem well. Here is my detailed requirement.
I have a table with data as below
Table: boxes
+------------+----------+
| box_id | Status |
+------------+----------+
| 1 | created |
| 2 | created |
| 3 | opened |
| 4 | opened |
| 5 | closed |
| 6 | closed |
| 7 | closed |
| 8 | wrapped |
+------------+----------+
With this there is also a status names destroyed But for which there is no box destroyed.
I need an output like this
+--------------+-------+
| Status | Count |
+--------------+-------+
| created | 2 |
| opened | 2 |
| destroyed | 0 |
| other_status | 4 | # this includes status (closed and wrapped)
| total | 8 |
+--------------+-------+
How can this be achieved in SQL. Thanks in advance