Cat_id 55 has mailed 1 person 3 times (i.e., purn 123)
Cat_id 55 has mailed 2 people 2 times (i.e., purns 456 & 678)
Cat_id 55 has mailed 1 person 1`time (i.e., purn 789)
Here's my real world example with output.....
select i.cid cat_id
,i.c no_times_mailed
,count(*) occurrences
from (select cat_id_for cid
,purn p
,count(*) c
from contact
where cat_id_for = 55
group by cat_id_for,purn) i
group by i.cid,i.c;
Bookmarks