Ver Mensaje Individual
  #3  
Antiguo 06-08-2004
Avatar de guillotmarc
guillotmarc guillotmarc is offline
Miembro
 
Registrado: may 2003
Ubicación: Huelva
Posts: 2.638
Reputación: 24
guillotmarc Va por buen camino
Hola.

Utiliza subconsultas, algo como :

Código:
select distinct fecha,
       (select sum(Importe) from Historico H2 where H1.fecha = H2.fecha and H2.categoria = 1) as consultas,
       (select sum(Importe) from Historico H2 where H1.fecha = H2.fecha and H2.categoria = 2) as cirugia,
       (select sum(Importe) from Historico H2 where H1.fecha = H2.fecha and H2.categoria = 3) as hospitalizacion
from Historico H1
Saludos.
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no).
Responder Con Cita