It is unclear from your question whether you want to sum the number of products bought in all visits by each customer and test that, or test against the number bought in each individual trip. But judging by the clarification, I think you want to look at individual trips, and you only want the customers who bought 3 or 4 items every time. Here are some queries that would do that.
select custno
from visits
where itemcount in (3, 4) and
custno not in
(select custno from visits where itemcount not in (3,4));
or this:
select custno
from visits a
where itemcount in (3, 4) and
not exist
(select custno from visits b
where b.custno=a.custno and itemcount not in (3,4));
And actually, the first test is redundant, so you could do this:
select distinct custno
from visits
where custno not in
(select custno from visits where itemcount not in (3,4));
Or it might be more efficient this way:
create temporary table badcounts
(custno int primary key)
select distinct custno from visits where itemcount not in (3,4);
select distinct custno
from visits v left join badcounts b using (custno)
where b.custno is null;
or you could try this:
select distinct custno
from visits v
left join (select custno from visits where itemcount not in (3,4)) b
using (custno)
where b.custno is null;
If you are always interested in a range, you could try this:
select custno from visits
group by custno
having min(itemcount) >= 3 and max(itemcount) <= 4;
This last one may be faster if you have an index on (custno, itemcount).