Como hacer la siguiente consulta?? es muy urgente.
Publicado por Leonardo Prada (27 intervenciones) el 22/08/2002 19:34:03
Hola hola,
Espero que se encuentren muy bien amigitos, me gustaria saber si me
pueden ayudar con lo siguiente:
con este query:
select nvl(dcie_unse,'OTROS') SERVICIO,0 VENTAS, sum(dcie_val) PAGOS
from siacc_tdcierr
where dcie_timo = 'PAGO'
and dcie_period between 200201 and 200204
group by dcie_unse
union
select nvl(dcie_unse,'OTROS') SERVICIO,sum(dcie_val) VENTAS, 0 PAGOS
from siacc_tdcierr
where dcie_timo = 'VENT'
and dcie_period between 200201 and 200204
group by dcie_unse
order by SERVICIO desc;
obtengo el siguiente resultado:
SERVI VENTAS PAGOS
----- ---------- ----------
TUSO 0 770215
TUSO 3920000 0
SALU 0 1500
SALU 2000000 100000
OTROS 0 80000
OTROS 100000 0
La pregunta es:
Como hacer para ver las VENTAS y sus PAGOS en una misma fila por cada SERVICIO
ejemplo:
SERVI VENTAS PAGOS
----- ---------- ----------
TUSO 3920000 770215
SALU 200000 1500
OTROS 10000 80000
En verdad muchas gracias.
Espero que se encuentren muy bien amigitos, me gustaria saber si me
pueden ayudar con lo siguiente:
con este query:
select nvl(dcie_unse,'OTROS') SERVICIO,0 VENTAS, sum(dcie_val) PAGOS
from siacc_tdcierr
where dcie_timo = 'PAGO'
and dcie_period between 200201 and 200204
group by dcie_unse
union
select nvl(dcie_unse,'OTROS') SERVICIO,sum(dcie_val) VENTAS, 0 PAGOS
from siacc_tdcierr
where dcie_timo = 'VENT'
and dcie_period between 200201 and 200204
group by dcie_unse
order by SERVICIO desc;
obtengo el siguiente resultado:
SERVI VENTAS PAGOS
----- ---------- ----------
TUSO 0 770215
TUSO 3920000 0
SALU 0 1500
SALU 2000000 100000
OTROS 0 80000
OTROS 100000 0
La pregunta es:
Como hacer para ver las VENTAS y sus PAGOS en una misma fila por cada SERVICIO
ejemplo:
SERVI VENTAS PAGOS
----- ---------- ----------
TUSO 3920000 770215
SALU 200000 1500
OTROS 10000 80000
En verdad muchas gracias.
Valora esta pregunta
0