Subject CAN FB RUN THIS SQL
Author kralj drago
Hi!

I have table orders with values:

ID ITEM PRICE CALCULATED_COLUMN
===================== =====================
1 101 100,10 100,10
2 103 104,00 204,10
3 100 51,21 255,31
........ etc

Can I build calculated column like describe in upper table example.

I build this SQL:
=========================================================================
SELECT O.ID, O.ITEM, (SELECT SUM(O1.PRICE) FROM ORDERS O1 WHERE O1.ID <=
O.ID )
FROM ORDERS O
ORDER BY O.ID

This work but SQL need sub query , what is waste of time because value are
known on each query iteration ...

Does FB suport acces to previos row values, to write this sql:
SELECT O.ID, O.ITEM, (OLD.CLC_PRICE + O.PRICE) AS CLC_PRICE
FROM
FROM ORDERS O

Thanks in advice,
Drago