I need a single query to fetch the counts based on some condition(oracle).
select count(*) AS TOTAL_ROWS from table
select count(*) AS TOTAL_ERROR_ROWS from table where ERROR_CODE is not null
select count(*) AS TOTAL_SUCCESS_ROWS from table where ERROR_CODE is null
I want to fetch all three results in 1 query. I have tried like below after googling but it is not working:
select
count(*) as TotalCount,
count(case when { where ERROR_CODE is not null} then 1 else 0 end) as QualifiedCount
from
wli_qs_report_attribute
select count(*) as TOTAL,
count(case when ERROR_CODE is not null then 1 else 0 end) as ExecCount,
from wli_qs_report_attribute
it doesn't work.