This question is based on my previous question on stackoverflow. This time I am trying to generate urls for all the rows in pages table using the Modified Preorder Tree method.<
Something like this should suffice...
SELECT CONCAT_WS('/',x.path,y.page_name) full_path
FROM
( SELECT node.id, GROUP_CONCAT(parent.title ORDER BY parent.lft SEPARATOR '/') path
FROM category node
JOIN category parent
ON node.lft BETWEEN parent.lft AND parent.rgt
GROUP
BY node.title
ORDER
BY node.lft
) x
JOIN pages y
ON y.category_id = x.id;