So I have a database where each record has a reference to a parent record in the same table (possibly null). Each record also has an 'active' flag that describes whether the single record is currently active.
I would like to end up with a flat list of records that have the following traits:
Instead of constructing the tree and doing a search to filter out the records I would like to accomplish this in SQL. Is there a way to join or aggregate to filter out the undesired records?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.