The intention is to sort the list by the parent, and then the child (there will only be one child).
Example Set:
ID ParentId Type Unit
1 NULL Energy kJ
2 1 Cal
3 NULL Protein g
4 NULL Fat, total g
5 4 Saturated g
6 NULL Carbohydrate g
7 6 Sugars g
8 NULL Dietary fibre g
10 NULL Sodium mg
11 NULL Potassium mg
So for example, if I sort by Type (alphabetical order) it would come up
- Carbohydrate
- Sugars (parent = 1.)
- Dietary fibre
- Energy
- Cal (parent = 4.)
- Fat, total
- Saturated (parent = 6.)