Another possibility would be a recursive query. I've no intuition about what would be more efficient.
Another possibility would be a recursive query. I've no intuition about what would be more efficient.