Self-referential Tables In SQL Are Tricky

One of the applications I work on exposes flattened reporting data as a SQL view. The systems that consume this data only support fetching it via direct database access, so I had to implement it as a read only view. The view itself is fairly complex, combining relational and summary data from 15 different...