ount++;
> > }
> > }
> > }
> > ==
> >
> > Please note that cat_list is given as a by-reference parameter.
>Otherwise
> > you'd be copying the whole array for each recursive function c
atabase at once (instead of calling a mysql SELECT statement for each
> branch of the tree).
>
> - Carsten
>
> > -Oprindelig meddelelse-
> > Fra: Carsten Gehling [mailto:[EMAIL PROTECTED]]
> > Sendt: 27. maj 2002 20:33
> > Til: [EMAIL PROTECTED]
> > E
database at once (instead of calling a mysql SELECT statement for each
> branch of the tree).
>
> - Carsten
>
> > -Oprindelig meddelelse-
> > Fra: Carsten Gehling [mailto:[EMAIL PROTECTED]]
> > Sendt: 27. maj 2002 20:33
> > Til: [EMAIL PROTECTED]
> > E
branch of the tree).
- Carsten
> -Oprindelig meddelelse-
> Fra: Carsten Gehling [mailto:[EMAIL PROTECTED]]
> Sendt: 27. maj 2002 20:33
> Til: [EMAIL PROTECTED]
> Emne: SV: building tree view in mysql?
>
>
> Well you'll neew to do some coding in your application langua
he database
once
> (for optimum performance).
>
> - Carsten
>
> > -Oprindelig meddelelse-
> > Fra: Sagi Bashari [mailto:[EMAIL PROTECTED]]
> > Sendt: 27. maj 2002 20:50
> > Til: olinux; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Emne: Re: building tree
ra: Sagi Bashari [mailto:[EMAIL PROTECTED]]
> Sendt: 27. maj 2002 20:50
> Til: olinux; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Emne: Re: building tree view in mysql?
>
>
>
> Yeah, thats exactly what I wanted to do. But how do I make MySQL sort it
> like that? Show the paren
Yeah, thats exactly what I wanted to do. But how do I make MySQL sort it
like that? Show the parent first, and then all its childs, so the
application can determite if it's subcategory by checking if the parent is
was changed.
Sagi
From: "olinux" <[EMAIL PROTECTED]>
> create a table like this
create a table like this:
id | parent_id | category
parent_id points to the parent categories id. Top
level categories get parent_id of '0'
ex:
1 | 0 | auto
2 | 1 | repair
3 | 2 | body
4 | 2 | windshields
5 | 1 | detailing
6 | 2 | tires
Tree would look like:
auto
repair
body
wi
HI,
>For trees you need self joins.
Could You please explain that ?
Regards,
At 19:11 23/05/02, Georg Richter wrote:
>On Thursday, 23. May 2002 16:16, Sagi Bashari wrote:
>Hi,
>
>
> >
> > How can I get MySQL to sort it like that? I tried to use group/order by,
> > but I cannot get it
so it depends on your client!
Hope It helps...
-Message d'origine-
De : Sagi Bashari [mailto:[EMAIL PROTECTED]]
Envoy? : jeudi 23 mai 2002 16:16
? : [EMAIL PROTECTED]
Objet : building tree view in mysql?
Hi,
I'm trying to build a simple categories tree in MySQL.
Say
On Thursday, 23. May 2002 16:16, Sagi Bashari wrote:
Hi,
>
> How can I get MySQL to sort it like that? I tried to use group/order by,
> but I cannot get it to sort it this way..
>
> Any ideas?
For trees you need self joins.
Regards
Georg
mysql, query
-
Hi,
I'm trying to build a simple categories tree in MySQL.
Say I have the following table:
CREATE TABLE test (
id int(10) unsigned NOT NULL auto_increment,
parent int(10) unsigned NOT NULL default '0',
name tinytext NOT NULL,
PRIMARY KEY (id),
KEY parent (parent)
) TYPE=MyISAM;
+---
12 matches
Mail list logo