In our database, a tree structure is implemented like this:
name path pos_left pos_right pos_level
folder1 207 214 1
file1 208 209 2
file2 210 211 2
file3 212 213 2
I need to set the path's values so that rows where pos_level is 2 would read like this: folder1/file1, folder1/file2, folder1/file3. So I need an SQL query which would take the name of the "parent" folder (but no parent_id is used in our system, only pos_left, pos_right, pos_level) concatenated with "/" and then with the entity's name.
I already have the simple stuff:
UPDATE table SET path = name WHERE pos_level = 1
And I need this:
UPDATE table SET path = (code I don't know) WHERE pos_level = 2
Thank you!