I have a problem regarding hierarchical data in SQL. Below is a simplified version of my current data table.
I need to goup all data with 'Group Flag' = 0 together underneither the lowest level that has 'Group Flag' = -1 so that the data looks like this.
How would I go about doing this using SQL? I amusing SQL Server 2008? I plan on creating a View that will then form the basis of a Crystal Reports report.