Answer the question
In order to leave comments, you need to log in
How to do recursion with 'for' posgres?
Good afternoon. There is a table in which links are indicated, 'from_id' to 'to_id'. By 'from_id' I get all the ids it refers to, take them and do the same. How to write a query to get and bypass all 'to_id' until I hit 'to_id' = None in each chain and return all id's that I have bypassed?
Answer the question
In order to leave comments, you need to log in
You can use a recursive query , but it's better to change the database schema under nested sets .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question