Subject | Update procedure/query |
---|---|
Author | miprivacidad |
Post date | 2002-02-14T23:48:44Z |
Hi list...
I'm still converting from BDE... getting to know IB.
I need to update an entire table from a query's result:
I used to have this query (In QRecalc's SQL):
SELECT MOV_ALM.Producto , MOV_ALM.Almacen , MOV_ALM.Presentacion,
SUM( MOV_ALM.Cantidad * CONCEPTS.Multiplicador ) AS SUM_OF_Cantidad
FROM MOV_ALM , CONCEPTS, PRODUCTS
WHERE
( ( MOV_ALM.Tipo_de_Movimiento = CONCEPTS.Numero ) AND
( MOV_ALM.Producto = PRODUCTS.Producto ) AND
( CONCEPTS.Tipo = 'Almacén' ) AND
( MOV_ALM.Aplicada = 'T' ) AND
( PRODUCTS.Inventariable = 'T' ) )
GROUP BY
MOV_ALM.Producto , MOV_ALM.Almacen, MOV_ALM.Presentacion;
And the procedure:
TRecalc1 : TIBOTable.
QRecalc1.First;
while not QRecalc1.EOF do
begin
if not TRecalc1.FindKey([QRecalc1Producto.AsString,
QRecalc1Almacn.AsString, QRecalc1Presentacin.AsString])
then
begin
TRecalc1.Insert;
TRecalc1Producto.AsString := QRecalc1Producto.AsString;
TRecalc1Almacn.AsString := QRecalc1Almacn.AsString;
TRecalc1Presentacin.AsString :=
QRecalc1Presentacin.AsString;
end
else
TRecalc1.Edit;
TRecalc1Existencia.AsFloat := QRecalc1SUMOFCantidad.AsFloat;
TRecalc1.Post;
QRecalc1.Next;
end;
which does work, but takes a lot of time...
How can I make this work faster and only in the server side? (I don't
need to take any decisions nor parameters)
Thanx in advance.
Jose Manuel
I'm still converting from BDE... getting to know IB.
I need to update an entire table from a query's result:
I used to have this query (In QRecalc's SQL):
SELECT MOV_ALM.Producto , MOV_ALM.Almacen , MOV_ALM.Presentacion,
SUM( MOV_ALM.Cantidad * CONCEPTS.Multiplicador ) AS SUM_OF_Cantidad
FROM MOV_ALM , CONCEPTS, PRODUCTS
WHERE
( ( MOV_ALM.Tipo_de_Movimiento = CONCEPTS.Numero ) AND
( MOV_ALM.Producto = PRODUCTS.Producto ) AND
( CONCEPTS.Tipo = 'Almacén' ) AND
( MOV_ALM.Aplicada = 'T' ) AND
( PRODUCTS.Inventariable = 'T' ) )
GROUP BY
MOV_ALM.Producto , MOV_ALM.Almacen, MOV_ALM.Presentacion;
And the procedure:
TRecalc1 : TIBOTable.
QRecalc1.First;
while not QRecalc1.EOF do
begin
if not TRecalc1.FindKey([QRecalc1Producto.AsString,
QRecalc1Almacn.AsString, QRecalc1Presentacin.AsString])
then
begin
TRecalc1.Insert;
TRecalc1Producto.AsString := QRecalc1Producto.AsString;
TRecalc1Almacn.AsString := QRecalc1Almacn.AsString;
TRecalc1Presentacin.AsString :=
QRecalc1Presentacin.AsString;
end
else
TRecalc1.Edit;
TRecalc1Existencia.AsFloat := QRecalc1SUMOFCantidad.AsFloat;
TRecalc1.Post;
QRecalc1.Next;
end;
which does work, but takes a lot of time...
How can I make this work faster and only in the server side? (I don't
need to take any decisions nor parameters)
Thanx in advance.
Jose Manuel