Hi, I would like to populate the children_ids column with all the ids of the children recursively (+ grandchildren etc.) If I do it top-bottom I will end up doing extra work since there is no need to go all levels down if I can just compute my IMMEDIATE children "children_ids" and just concatenate all
their lists. But was not able to get it to work on my case.
Your assistance is most welcome! create table tree(id int primary key, parent int, children_ids text); insert into tree (id, parent) values (273, 0), (274, 273), (275, 273), (277, 273), (278, 277), (280, 275), (281, 280), (282, 281), (283, 282), (284, 282), (285, 282), (286, 282), (287, 282), (288, 282), (289, 282), (290, 281), (291, 290), (292, 290), (293, 290), (294, 290), (295, 290); |