SELECT count(*) FROM ContactAction WHERE (Type=0 AND Campaign=#47:16) GROUP BY Contact
insert into ContactAction(Type,Campaign,Contact) values (0,#47:16,#38:0)
insert into ContactAction(Type,Campaign,Contact) values (0,#47:16,#38:0)
insert into ContactAction(Type,Campaign,Contact) values (0,#47:16,#38:0)
insert into ContactAction(Type,Campaign,Contact) values (0,#47:16,#38:0)
insert into ContactAction(Type,Campaign,Contact) values (0,#47:16,#38:0)
insert into ContactAction(Type,Campaign,Contact) values (0,#47:16,#38:1)
insert into ContactAction(Type,Campaign,Contact) values (0,#47:16,#38:1)
SELECT Contact, count(*) FROM ContactAction GROUP BY Contact
SELECT count(*) FROM ContactAction => 7 ~ total rows in ContactAction
SELECT count(*) FROM ContactAction GROUP BY Contact => 2 ~ number of contacts having any ContactAction row
SELECT Contact, count(*) FROM ContactAction GROUP BY Contact => 2 rows of [contact id, number of ContactAction row by contact id]
SELECT count(*) FROM (SELECT FROM ContactAction GROUP BY Contact)
SELECT count(distinct(Contact)) FROM ContactAction