Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/10/2009, 16:54
gagomen
 
Fecha de Ingreso: octubre-2009
Mensajes: 2
Antigüedad: 14 años, 6 meses
Puntos: 0
Problema con Select

Si alguien me puede ayudar a unir los siguientes select para que entregue 1 fila con resultados.

La idea es obtener algo como

Año/mes CodigoPunto GlosaPunto Aceptados Anulados Operac99
Enero 01 Punto01 100 0 10
Enero 02 Punto02 200 20 15
Febrero 01 Punto01 50 1 2
Febrero 02 Punto02 80 10 30
Febrero 03 Punto03 100 20 5
etc

Este query entrega un resultado de documentos Aceptados.

select to_char(a.fecha,'yyyy/mm') "Año/Mes",a.codigo_punto "Punto",b.glosa_punto "Glosa",count(*) "Cantidad"
from documento a,punto_control b
where a.fecha between to_date('01012008','ddmmyyyy')
and to_date('31082009','ddmmyyyy')
and a.Estado_documento <>'N'
and a.codigo_punto=b.codigo_punto
and a.documento_tipo in ('101','102','151','152','200')
group by to_char(a.fecha,'yyyy/mm'),a.codigo_punto,b.glosa_punto
order by to_char(a.fecha,'yyyy/mm')


Este query entrega un resultado de documentos Anulados.

select to_char(a.fecha,'yyyy/mm') "Año/Mes",a.codigo_punto "Punto",b.glosa_punto "Glosa",count(*) "Cantidad"
from documento a,punto_control b
where a.fecha between to_date('01012008','ddmmyyyy')
and to_date('31082009','ddmmyyyy')
and a.Estado_documento ='N'
and a.codigo_punto=b.codigo_punto
and a.documento_tipo in ('101','102','151','152','200')
group by to_char(a.fecha,'yyyy/mm'),a.codigo_punto,b.glosa_punto
order by to_char(a.fecha,'yyyy/mm')

Este query entrega un resultado de documentos en Codigo Operacion 99.

select to_char(a.fecha,'yyyy/mm') "Año/Mes",a.codigo_punto "Punto",b.glosa_punto "Glosa",count(*) "Cantidad"
from documento a,punto_control b
where a.fecha between to_date('01012008','ddmmyyyy')
and to_date('31082009','ddmmyyyy')
and a.codigo_operacion='99'
and a.codigo_punto=b.codigo_punto
and a.documento_tipo in ('101','102','151','152','200')
group by to_char(a.fecha,'yyyy/mm'),a.codigo_punto,b.glosa_punto
order by to_char(a.fecha,'yyyy/mm')

Si alguien me puede ayudar, desde ya se lo agradezco mucho.