Express union which is dependent on other results I would like to make a union of two tables that are actually in a hierarchical constellation.

How would I write that in relational algebra? Say table A is the parent of B in a 1:n relationship.

First I do a selection on A and then I want to only make a union with these entries in B that would be in a join with selection on A.

I would like to write it the way that a database would evaluate it.

Is there such a thing as a conditional union?
If I understood the question well, your task can be solved by using recursive queries. Oracle (see  and SQLServer (2005 and higher) both support it. Surely, different RDMS vendors use a slightly different syntax.