The MySQL nested set model is used to print "parent from child" but it doesn't work
Below is the table containing the category.
Table containing the
Below is a query that prints the parent from the child's perspective.
select node.rgt, concat(repeat(', count(parent.category_name)-1), node.category_name) as name, node.category_description
from category as node, category as parent
where node.lft between parent.lft and 4
group by node.category_name order by node.lft;
Below is the result of the query.
Looking at the execution results, I would like to display the execution results in three columns per line.
How do you think it will work?I look forward to your kind cooperation.
Why don't you use GROUP_CONCAT?
select node.rgt, GROUP_CONCAT(node.category_name SEPARATOR'') as name...
You can use DISTINCT or ORDER BY inside GROUP_CONCAT.
This is the hierarchical data of the nested model.
http://www.geocities.jp/mickindex/database/db_tree_ns.html
Wouldn't it work if you refer to 2-7. Enumerate Paths (Columned Version) on this site?
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
918 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.