Subject | sql problem |
---|---|
Author | duilio_fos <irel_llc@libero.it> |
Post date | 2003-02-16T21:41:35Z |
a table is structured like a linked list:
create ATable (
id integer not null,
fm_id integer not null
)
ID is unique for every row.
Every row (say row with ID 56) can have N children.
If N is 3, we could have tuples like
(100,56), (121,56), (133,56)
where all the 3 rows have different IDs, but all share the common
ancestor ID.
Given row with ID X, which SQL instruction(s) can list - say - 30
ancestors ?
Thank you
Duilio Foschi
create ATable (
id integer not null,
fm_id integer not null
)
ID is unique for every row.
Every row (say row with ID 56) can have N children.
If N is 3, we could have tuples like
(100,56), (121,56), (133,56)
where all the 3 rows have different IDs, but all share the common
ancestor ID.
Given row with ID X, which SQL instruction(s) can list - say - 30
ancestors ?
Thank you
Duilio Foschi