Here is the example table:
And I want output like this:
Use conditional aggregation:
select wf_name,
count(*) filter(where crt_by = 'ADHOC') adhoc,
count(*) filter(where crt_by = 'SCHEDULE') schedule
from mytable
group by wf_name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.