Well you'll neew to do some coding in your application language. What are
you using to connect to MySQL? Perl? PHP? Java?

Tell me, and I'll give you an example where you only query the 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 view in mysql?
>
>
>
> 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:
> > 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
> >       windshields
> >       tires
> >    detailing
> >
> > olinux
> >
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to