I have seen a lot of answers to this question, but I still can't figure out how to do it. I'm using Sybase. But I prefer a standard SQL answer.
I have a table that forms a number of tree structures. I would like to get the list of all child nodes given a set of parent nodes. For example take the table below
parent child
AA AAB
AA AAC
AAB AABA
AAB AABB
AAB AABC
AAB AABD
AAB AABE
AAB AABF
AABB AABBC
AABB AABBA
AABB AABBB
AABB AABBC
BB BBA
BB BBB
BBB BBBA
so basically, I want a query that, given the input AA and BB, it would give me all the entries above. Suppose the above is a directory structure, the result is similar to get me all the subdirectories recursively of one of more root.
As I said, I saw the question asked so many times, but still I couldn't find an answer I could use. There was a few links to outside articles, I read 3 or 4, but I think I can't translate that into SQL. (My sql expertise is rusty a bit).
thank you