Hi,
This is an example of an table that I store categories in. Each category
have a id and also a parent. If the parent_id is 0 that category is a
super-category.
Assume that I would like to get a list of all categories and its parent
category, grandparents category etc down to super-category.
-
From: Peter Lauri [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 18, 2006 8:20 PM
To: mysql@lists.mysql.com
Subject: Recursive query
Hi,
This is an example of an table that I store categories in. Each category
have a id and also a parent. If the parent_id is 0 that category is a
super-category
Peter,
Right now I am doing this with PHP and a recursive function, but is it
possible to do this directly with one query?
SQL is not recursive, so you need an sproc. There are some examples with
discussion at
http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html.
PB
-
://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html
You had me at EHLO --E.Webb (10.04.05)
-Original Message-
From: Gokhan Demir [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 18, 2006 12:11 PM
To: mysql@lists.mysql.com
Subject: RE: Recursive query
After deciding a max level, you can
hi,
how can i make recursive querys in mysql?
i want to show a tree.
my table:
tree (id int, parent int, name char(10));
id parent name
--
1 0 joe
2 1 mike
3 1 jim
4 2 george
5 3
http://marc.theaimsgroup.com/?l=mysqlm=99213870412899w=2
http://marc.theaimsgroup.com/?l=mysqlm=99214323317893w=2
http://www.bolt.cx/misc/thread.txt
hi,
how can i make recursive querys in mysql?
i want to show a tree.
my table:
tree (id int, parent int, name char(10));
...
thanks