Sorting a subtree in a closure table hierarchical-data structure
I would like to ask you to help me with the problem with sorting of the hierarchical data structure stored as a closure table . I wanted to use this structure to store my website menu. Everything works fine, but the problem is that I do not know how to sort the exact subtree in a custom order. At the moment the tree is sorted in the order in which the items were added to the database. My structure is based on Bill Karwin's article about Closure Tables and some other posts. Here is my MySQL database structure with some DEMO data: -- -- Table `category` -- CREATE TABLE IF NOT EXISTS `category` (