I am hoping to generate unique contact %. not sure how to divide the 2. Can someone help? thanks
select
attached to_,
count(record),
count(distinct customer),
from table
group by 1
CodePudding user response:
Try the following:
Select attached_to,
COUNT(customer) As total_contact,
COUNT(Distinct customer) As unique_contact,
COUNT(Distinct customer) / COUNT(customer) As '%_of_unique'
From Tbl
Group By attached_to
See a demo from db<>fiddle.