O "having" é utilizado para restringir consultas que utilizam funções de agrupamento, como Max, Min, Count etc...
Veja o exemplo:
create table #teste (id int, nome varchar(100))
insert #teste values
(1,'11'),
(1,'1111'),
(2,'22'),
(3,'22')
select id,
nome
from #teste
where id = 1
select id,
count(*)
from #teste
group by id
having count(*) = 2
Tulio Rosa | http://tuliorosa.com.br | Se resolveu seu problema, marque como resposta ou vote