I have a table named Project in which a parent-child relationship is stored.
An entry in the parentprojectid column implies that the respective project instance is a child.
The columns of the table are as follows:
projectid, parentprojectid
When I run a SELECT query on this table, the resulting data should consist of every parent followed by all of its children (and the children of its children, if applicable). How do I achieve this?
Here is an example of what the data looks like:
projectid parentprojid proj1 null proj11 proj1 proj12 proj1 proj121 proj12 proj2 null proj3 null