On Mon, 10 Dec 2007 12:23:49 +0000 (GMT) Ashish Karalkar <ashish_postgre@xxxxxxxxxxx> wrote: > Hello there, > I am having data in table something like below: > > user_id type_id > 1 1 > 1 2 > 2 1 > 3 3 > 4 3 > 5 1 > 1 10 > 7 6 > > What i want is the count of all user group by type_id who are > subscribed to only one type e.g > > type_id count > 1 2 1 3 > 6 1 This is not to "only one type" or I didn't get the question. Something like create table pippo ( user_id int, type_id int); insert into pippo values(1,1); insert into pippo values(1,2); insert into pippo values(2,1); insert into pippo values(3,3); insert into pippo values(4,3); insert into pippo values(5,1); insert into pippo values(1,10); insert into pippo values(7,6); select type_id, count(*) from pippo group by type_id having count(*)=1; 10;1 6;1 2;1 -- Ivan Sergio Borgonovo http://www.webthatworks.it ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings