Ver Mensaje Individual
  #5  
Antiguo 31-07-2003
Newbie Newbie is offline
Miembro
 
Registrado: jul 2003
Ubicación: Veracruz, México
Posts: 30
Reputación: 0
Newbie Va por buen camino
Ya lo hice, gracias!!!
En efecto, Interbase no da la capacidad de hacer lo que yo pretendía, pero tampoco recurrí a la creación de una vista. Lo que hice fue crear el siguiente procedimiento almacenado
Código:
CREATE PROCEDURE "Totales_Remesa" 
RETURNS (
    SCVE_SUCURSAL INTEGER,
    ABREVIATURA VARCHAR(3),
    TOTAL INTEGER)
AS
begin
  for Select Scve_Sucursal, CABreviatura3,
             (select sum(stotal) from Numeracion_remesa where scve_sucursal = S.scve_sucursal
             and cstatus = 'G') Total
      from sucursal S
      into  :scve_sucursal, :abreviatura, :total
  do
      begin
        if (total is null) then
          total = 0;
        suspend;
      end
end
y lo llamo para saber el total en cada tienda; y cuando quiero obtener el total de todas las tiendas apoyándome en el mismo procedimiento almacenado, lo que hago es
Código:
select sum(total) from "Totales_Remesa"
o bien, directamente con un query obtengo el total de todas las tiendas
Código:
select sum(stotal) from Numeracion_remesa where cstatus = 'G'
Gracias por su apoyo
Responder Con Cita