Oracle — multiple count statistics. Multiple fields in a table are equal to a certain value.

Excerpts: https://www.linuxidc.com/Linux/2012-06/62894.htm

case when The conditional then condition is true when the value of else is false and the value is end.

--Query the number of times a unified field is equal to a value.
select count(m.underwriteflag) from prpcmain m where m.underwriteflag='1'  ; --720407
select count(m.nationflag) from prpcmain m where m.nationflag='1'         --720422

--Merge querySelectcount(case when m.underwriteflag='1' then 1 end)Field 1, count (case when m.nationflag='1'then 1 end) field 2 from prpcmain m;

  

 

Leave a Reply

Your email address will not be published. Required fields are marked *