Profile example for adult site - Query for updating a node in a hierarchial tree structure

by  |  11-Sep-2017 18:02

It’s fairly common to want to store hierarchical data in a database table.

Examples of such data might be categories with unlimited subcategories, data related to a multilevel menu system or a literal representation of hierarchy such as departments in a company.

If you look at the nested_category table, you may notice that the lft and rgt values for leaf nodes are consecutive numbers.

To find the leaf nodes, we look for nodes where rgt = lft 1: SELECT FROM nested_category AS node, nested_category AS parent WHERE BETWEEN AND AND = 'FLASH' ORDER BY parent.lft; ---------------------- | name | ---------------------- | ELECTRONICS | | PORTABLE ELECTRONICS | | MP3 PLAYERS | | FLASH | ---------------------- We have already looked at how to show the entire tree, but what if we want to also show the depth of each node in the tree, to better identify how each node fits in the hierarchy?

However once have in memory the tree data the application need a way to save them for future use.

Query for updating a node in a hierarchial tree structure

User
Get that thing purring, rev it, and you can ride that rocket to the moon, baby. Online, somebody noticed that the photo of the teacher was from a Japanese porno movie. …
speeddatingcities com

Community Discussion