I have a SQL Database where my query retrieves data from the database like so:
TreeLevel Food Type InventoryNbr SeqNbr
1 Flat Bread - 37
2 With Swiss Cheese 300 38
2 Condiment - 39
3 With Mayo 301 40
3 With Mustard 302 41
The Tree Level column indicates applications that need to be grouped together. Food type indicates the type of food. InventoryNbr is my internal inventory number, and SeqNbr is a sequencing number used to sort the database.
When the InventoryNbr is blank, it indicates that one of the food types in the tree level after it needs to go with it. I'm trying to write a SQL query that concatenates these into single rows with very little luck. My desired effect is:
TreeLevel Food Type InventoryNbr SeqNbr FullFoodType
1 Flat Bread - 37 -
2 With Swiss Cheese 300 38 Flat Bread With Swiss Cheese
2 Condiment - 39 -
3 With Mayo 301 40 Flat Bread With Swiss Cheese Condiment With Mayo
3 With Mustard 302 41 Flat Bread With Swiss Cheese Condiment With Mustard
The deepest tree level is 11 deep.
Is this even possible or am I chasing my tail?
I apologize for the poor alignment and appreciate any help.