Sample Header Ad - 728x90

sum() of aggregate count()?

2 votes
2 answers
232 views
I have a query where I pull the domain portion from email addresses out of a column and then count how many users from which domain I have. How do I get the total count (all users over all domains) in the same query?
select count(regexp_replace( email_id , '^[^@]+@','')) as count, regexp_replace( email_id , '^[^@]+@','') as domain from logins 
  where last_login between '2024-08-06' and '2024-09-06'  
  group by regexp_replace( email_id , '^[^@]+@','') 
  order by count;
Asked by tink (155 rep)
Sep 10, 2024, 08:52 PM
Last activity: Sep 12, 2024, 06:11 AM