Tienen razón, las formas de envío están en la tabla SUSCRIPCIONES. Esto fue un error que cometí hace años
, quedó así y hoy es muy pero muy difícil modificar la BD. Es grande y de un gran uso...
Algo que me funcionó fue esto:
Código SQL
[-]
Select COALESCE(SUM(s.CANT_EJEMPLARES), 0) AS CORREO,
(Select COALESCE(SUM(s.CANT_EJEMPLARES), 0) AS cant_reserva
From SUSCRIPCIONES s
Where (s.TIPO_SCIONES = 'PAPEL' or s.TIPO_SCIONES = 'PAPEL E INTERNET')
and s.ESTADO_SCIONES = 'A'
and '2013/06/08' BETWEEN s.f_inic_sciones AND s.f_fin_sciones
and s.cod_sucursal = 1
and s.forma_envio = 'RETIRA') AS RETIRA,
(Select COALESCE(SUM(s.CANT_EJEMPLARES), 0) AS cant_reserva
From SUSCRIPCIONES s
Where (s.TIPO_SCIONES = 'PAPEL' or s.TIPO_SCIONES = 'PAPEL E INTERNET')
and s.ESTADO_SCIONES = 'A'
and '2013/06/08' BETWEEN s.f_inic_sciones AND s.f_fin_sciones
and s.cod_sucursal = 1
and s.forma_envio = 'ESTAFETA') AS ESTAFETA
From SUSCRIPCIONES s
Where (s.TIPO_SCIONES = 'PAPEL' or s.TIPO_SCIONES = 'PAPEL E INTERNET')
and s.ESTADO_SCIONES = 'A'
and '2013/06/08' BETWEEN s.f_inic_sciones AND s.f_fin_sciones
and s.cod_sucursal = 1
and s.forma_envio = 'CORREO'
Group by s.forma_envio
Está medio rebuscado, pero cuando alguna de las formas de envío no tiene ejemplares muestra un null, que lo puedo interpretar como "cero"
En lugar de hacer una fila por cada forma de envío, hice una columna (esto no es tan dramático, porque las formas de envío no han cambiado en años)