SQL query records showing in table

????? UFABET

In this table, one column called Status. It will contain possible values(1 or 2).

Status    1 means  success

Status     2 means Failure

 In the front end,  I have to show batch_fk and success and failure count in frond end table.

So, I have written a SQL query to fetch the success and failure count from status column of Test2 table


select {Test2}.[batch_fk],count(*) from {Test2} where {Test2}.[status]=1 group by {Test2}.[batch_fk];

This above query is for taking success count

Likewise, I have written a SQL query to fetch the error count as well. If the status is 2 means error


select {Test2}.[batch_fk],count(*) from {Test2} where {Test2}.[status]=2 group by {Test2}.[batch_fk];

In the frond end, I am able to show the batch_fk and success count. But I am not able to show the error count for each batch_fk since the query is different for error.

I have given the source for the table is SQL1.List.

How can I show the error count also in the table?

This is a duplicate question. Please refer;

With best regards,