Currently have a query that hits AWS Redshift. I have this group by a recipient in order to count the total of the output.
select count(CASE WHEN event_name = 'c' THEN 1 END)
from oe
where owner_id = $1
and rid = $2
and cid = $2
and rbid is not null
group by recipient
having count(CASE WHEN event_name = 'c' THEN 1 END) > 0
and count(CASE WHEN event_name = 'd' THEN 1 END) > 0
The output from that is this
5
4
1
1
I'd like to be able, to sum up those numbers to produce a final number, as well as count the number of rows. How can I go about achieving this?