I Have 4 Request Status ID (0,1,2,3)
I have this table structure with data
INSERT INTO `test` (`Requestid`, `RequestStatusID`) VALUES
(1, '0'),
(2, '0'),
(3, '2'),
(4, '2'),
(5, '3');
I need to count the Counts for all RequestStatusID with this query:
SELECT COUNT(*) AS Counts,RequestStatusID FROM tblRequest GROUP BY RequestStatusID
this return following column
| Counts |RequestStatusID
_________________________________
1 | 2 | 0
_________________________________
2 | 2 | 2
_________________________________
3 | 1 | 3
This works but the problem is that i need to display all results even if the count result is 0.
That means it does not display count result is 0.
The output should be
|Counts |RequestStatusID
_________________________________
1 | 2 | 0
_________________________________
2 | 0 | 1
_________________________________
3 | 2 | 2
_________________________________
4 | 1 | 3
What I have tried:
I need to count the Counts for all RequestStatusID even if the count result is 0.