答案 0 :(得分:0)
按名称排序应该会给您预期的结果:
SELECT *, CASE WHEN parent = 0 THEN id ELSE parent END AS sort FROM article_category
ORDER BY name
答案 1 :(得分:0)
根据我的理解: -
您应该将列名称命名为
SELECT * FROM article_category
ORDER BY NAME
更新: SQLFiddle
SELECT *, (CASE WHEN parent = 0 THEN id ELSE parent END) AS sort FROM article_category
ORDER BY name, sort, id