I have a table that contains parent-child data like this:
Table_name | Child_table_name |
---|---|
A | B |
A | C |
B | D |
B | E |
C | F |
C | end |
D | end |
E | end |
F | end |
I want to be able to recursively read through the table, appending the values to a string variable so that I end up with the following (the different “routes” through the data, starting at A):
A B D end
A B E end
A C F end
A C end
My program is a BigQuery stored procedure.
Any ideas how I might achieve this? I believe I’m unable to make use of Recursive CTEs in a stored procedure.
Thanks.