SQL Query – How to combine 2 count statements in to single query

  Kiến thức lập trình

I have 2 queries which give count of cases based upon a condition

Query 1:

Select count(unique c.caseid) as New_cases from caseinfo c where 
(c.crtdate between TO_DATE('2024/07/08') AND TO_DATE('2024/07/11')) and c.channel is not null;

Query 2:

Select count(unique c.caseid) as Old_cases from caseinfo c where 
(c.crtdate between TO_DATE('2024/07/08') AND TO_DATE('2024/07/11')) and c.channel is null;

Both the queries have just a difference of null condition at the end.How can we combine these 2 in to a single query.

Any help would be appreciated.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT