Hi, Not sure I'm on the right forum for that, but here we go. I have a problem writing an algorithm for doing what I want. I have two simple SQL table that I need to show you in order to explain my problem:
[Query] (QueryId, QueryName) [QueryLink] (QueryLinkId, QueryId, LinkedQueryId) Nothing spectacular. The [QueryLink] table allows linking two records from the [Query] Table together (QueryId and LinkedQueryId). Now I can build a whole tree like that. An example would be: |-Query1 | | | |-Query2 | |-Query3 | |-Query2 | | | |-Query3 | |-Query4 | | | |-Query3 | |-Query3 | | | |-Query5 | gives: Query1 -> Query2 -> Query3 -> Query5 Query1 -> Query3 -> Query5 Query2 -> Query3 -> Query5 Query4 -> Query3 -> Query5 Query3 -> Query5 How can I do a proper recursion to get to this pattern ? Thanks