I am creating an administration backend to a proposal submission system.
Proposals have several columns in the table. One of these columns is called status - in which there are 10 different statuses.
I am trying to build an overview page that details how many proposals are pending, rejected, etc.
The status is an integer (which is the key to another table that has an id and a status name). Is there a way I can count all of the rows in the proposals table that has a status of 1 (pending) and all the other statuses in the same query? I know I can do something like -
SELECT
COUNT(*)
FROM
proposals
WHERE
status = 1;
But then I would have to do that 9 other times - taking up space and time. I am hoping that there is a way of doing this in one query, instead of 10.
Any help would be appreciated.