Subject Re: [firebird-support] Subselect in SP
Author Helen Borrie
At 05:34 AM 24/04/2007, SET wrote:
>Simple Jorge,
>
>select min(FACTURAS.FECHA)
>FROM ITEMS_FACTURAS
>JOIN FACTURAS ON ITEMS_FACTURAS.ID_FACTURA = FACTURAS.ID_FACTURA
> AND ITEMS_FACTURAS.SUCURSAL = FACTURAS.SUCURSAL
>WHERE FACTURAS.SUCURSAL=1 AND ITEMS_FACTURAS.CODIGO_PRODUCTO=31344
>
>No need to do simple things the complex way!
>Set

...in a SP, of course, that won't work either.

create procedure blah ....
...
as
declare variable min_fecha numeric(18,2);
....
begin
select ....
into :min_fecha;
...
end

./heLen