Ver Mensaje Individual
  #1  
Antiguo 16-08-2004
squenda squenda is offline
No confirmado
 
Registrado: dic 2003
Ubicación: México D.F.
Posts: 61
Reputación: 0
squenda Va por buen camino
problemas al agrupar en interbase

hola a todos, tengo que hacer un concentrado mensual de ingresos por categoria, hice la siguiente sentencia:

select fecha,
(select sum(Pagado) from Historia H2 where H1.fecha = H2.fecha and H2.categoria = 'CONSULTA') as CONSULTAS,
(select sum(Pagado) from Historia H2 where H1.fecha = H2.fecha and H2.categoria = 'HOSPITALIZACION') as HOSPITALIZACION,
(select sum(Pagado) from Historia H2 where H1.fecha = H2.fecha and H2.categoria = 'RX') as RX,
(select sum(Pagado) from Historia H2 where H1.fecha = H2.fecha and H2.categoria = 'OTROS') as otros,
(select sum(Pagado) from Historia H2 where H1.fecha = H2.fecha and H2.categoria = 'PAGO') as pago
from Historia H1
WHERE
H1.Fecha BETWEEN '08/14/2003' AND '08/14/2004'
order by H1.fecha

el query funciona, el problema es que no filtra por rango de fechas, si alguien me pudiera auxiliar, necesito poder filtrar por un rango de fechas.

Gracias

Saludos
Responder Con Cita