I finally installed 4.1 alpha so I could test the group_concat
function but need some help... could anyone give me a clue how
I can order the results of group_concat() according to the lft
field ? (just adding it per se wipes out the results)

I have tried many many variations and have not hit upong the
right combo yet.. would a user variable help ? Any clues welcome.

select group_concat(p.nam order by p.nam desc SEPARATOR "/") as name,
c.lft, c.rgt, c.nam from myTree p, myTree c
where c.lft between p.lft and p.rgt group by p.nam;

+-----------------------------------------+-----+-----+------------------+
| name                                    | lft | rgt | nam              |
+-----------------------------------------+-----+-----+------------------+
| Root/anewfolder                         |  12 |  23 | anewfolder       |
| Root/images/branch.gif/anewfolder       |  16 |  17 | branch.gif       |
| Root/images/branchbottom.gif/anewfolder |  18 |  19 | branchbottom.gif |
| Root/images/branchtop.gif/anewfolder    |  20 |  21 | branchtop.gif    |
| Root/cattest.sql                        |   6 |   7 | cattest.sql      |
| Root/example.php                        |   8 |   9 | example.php      |
| Root/images/anewfolder                  |  15 |  22 | images           |
| Root/index.php                          |  10 |  11 | index.php        |
| Root/newobj/anewfolder                  |  13 |  14 | newobj           |
| Root/old                                |  24 |  27 | old              |
| Root/oldindex.php/old                   |  25 |  26 | oldindex.php     |
| Root                                    |   1 |  28 | Root             |
| Tree.php/Root                           |   2 |   3 | Tree.php         |
| TreeMenu.php/Root                       |   4 |   5 | TreeMenu.php     |
+-----------------------------------------+-----+-----+------------------+

If I add "order by c.lft" everything is ideal except the
group_concat() output is gone.

+------+-----+-----+------------------+
| name | lft | rgt | nam              |
+------+-----+-----+------------------+
|      |   1 |  28 | Root             |
|      |   2 |   3 | Tree.php         |
|      |   4 |   5 | TreeMenu.php     |
|      |   6 |   7 | cattest.sql      |
|      |   8 |   9 | example.php      |
|      |  10 |  11 | index.php        |
|      |  12 |  23 | anewfolder       |
|      |  13 |  14 | newobj           |
|      |  15 |  22 | images           |
|      |  16 |  17 | branch.gif       |
|      |  18 |  19 | branchbottom.gif |
|      |  20 |  21 | branchtop.gif    |
|      |  24 |  27 | old              |
|      |  25 |  26 | oldindex.php     |
+------+-----+-----+------------------+

--markc


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to