I have an oracle DB w/ a table that contains records associated to a person (based on an ID). The records are categorized as category = 1, 2, or 3.

I would like to pull as follows:  

- # of people with only a category 1 record (no category=2 or 3)   

- # of people with only a category 2 record (no category=1 or 3)   

- # of people with only a category 3 record (no category=1 or 2)   

- # of people with both category 1 & 2 records (no category=3)   

- # of people with both category 1 & 3 records (no category=2)   

- # of people with all category records 1,2, & 3   

- # of people with both a category 2 & 3 records (no category=1)   

I could only think of the following solution (modified for each case):

```
select count(*) from table1
where id in (select id from table1 where category=1)
and id not in (select id from table1 where category=2)
and id not in (select id from table1 where category=3)

```

But, I believe this is a highly inefficient way of doing this, was wondering if anyone had quicker/better way of getting this info.

Thanks!