Could you help me? How can I re-sort the same-level classes in an unlimited category? {code ...} fullpath is sorted, but orderby requires that the second column be used only when the first column is the same when multiple columns are sorted. However, the first group of fullpath cannot be the same. Excuse me...
Could you help me?
How to re-sort the same-level categories in an unlimited category
SELECT `DishCategory_Path`,`DishCategory_Name`,`DishCategory_Sort`,concat(`DishCategory_Path`,'-',id) as fullpath from chi_category order by fullpath asc,`DishCategory_Sort`asc
Fullpath is sorted, but order by requires that the second column is used only when the first column is the same. However, the first group of fullpath cannot be the same. How can we sort lower-level red wine 1 and red wine 2.
Ask for advice
Reply content:
Could you help me?
How to re-sort the same-level categories in an unlimited category
SELECT `DishCategory_Path`,`DishCategory_Name`,`DishCategory_Sort`,concat(`DishCategory_Path`,'-',id) as fullpath from chi_category order by fullpath asc,`DishCategory_Sort`asc
Fullpath is sorted, but order by requires that the second column is used only when the first column is the same. However, the first group of fullpath cannot be the same. How can we sort lower-level red wine 1 and red wine 2.
Ask for advice
I took a closer look at the problem.
The first field is the parent level...
You only need to extract all the categories in one brain and sort them in Dynamic Language.
Old answer:
Add another fieldfather
, Red wine 1 and red wine 2father
All0-12-16
.
SELECT DishCategory_Path,DishCategory_Name,DishCategory_Sort, concat(DishCategory_Path,'-',id) as fullpath from chi_category order by concat(DishCategory_Path,'-',DishCategory_Sort)
Effect of this sentence
In fact, I don't know what the problem is ultimately to solve, and what the demand is.
If you want to output the secondary classification by sorting on the page, it is not what SQL does.