Select com totalizações diferentes

SQL Server

29/05/2009

Olá,

Como devo fazer para montar um select para me retornar a seguinte estrutura de atendimentos por funcionario:
MATRICULA NM_FUNCIONARIO DIA 20 DIA 22
----------- --------------------------------- --------- --------
1 JOAO 1 1
2 MARIA 1 1
3 PEDRO 1 0
4 RICARDO 1 0

consegui fazer até o dia 20 com o select abaixo mas não consigo totalizar o dia 22 na mesma estrutura. Como devo fazer ????

select f.matricula, f.nm_funcionario, count(s.cd_solicitacao) as ´Dia 20 ´,
´Dia 22 ´ as ´Dia 22´ from tb_funcionario f
left join tb_solicitacao s
on (f.matricula = s.matricula)
where s.data_abertura = ´20-06-2007´
group by f.matricula, f.nm_funcionario


Fredgentil

Fredgentil

Curtidas 0
POSTAR