I have a table that is related to one myself. Each entry can contain n children from the same table. for instance
create table folder
ID: Number 20 PK
PARENT_ID: Number 20 FK references folder.ID
SIZE: NUMBER 20
...
Given the ID, I want to select SUM (SIZE) of all folder entries recursively. The target database is MySql 5, but it would be nice if it were common enough to work in Oracle and MS-SQL.
I will not know how deep the tree is, maybe 1 level, maybe 50 (or more)
source
share