List:General Discussion« Previous MessageNext Message »
From:Daniel Łaś Date:October 23 2001 6:12am
Subject:ODP: Tree in SQL
View as plain text  
Hi

I have one table and the depth is not always the same.

Anyway thanks :)

____________________________________
Daniel Łaś
e-direct Polska sp. z o.o.
WWW: http://www.e-direct.pl
E-mail: daniel.las@stripped
45-072 Opole ul. Reymonta 45
tel. +48 77 44 26 073
fax. +48 77 44 26 074

> -----Oryginalna wiadomość-----
> Od: Steve Meyers [mailto:steve-mysql-mainlist@stripped]
> Wysłano: 23 października 2001 07:44
> Do: Daniel Lao; Lista MySQL
> Temat: RE: Tree in SQL
>
>
> If the depth of the tree is always the same, it is actually
> fairly easy.  For instance, if there are three levels:
>
> SELECT c.group_id FROM table a, table b, table c WHERE a.group_id
> = 12345 AND b.group_id = a.parent_group_id AND c.group_id =
> b.parent_group_id
>
> If you don't know the depth, you'll have to do a recursive search
> (keep on querying for the next parent until you run out of parents).
>
> Steve Meyers
>
>
> > -----Original Message-----
> > From: Daniel Łaś [mailto:daniel.las@stripped]
> > Sent: Monday, October 22, 2001 3:34 PM
> > To: Lista MySQL
> > Subject: Tree in SQL
> >
> >
> > Hi
> >
> > I have a table in database which describes tree structure of
> > article groups.
> > In this table I have:
> > 1. group_id - group identifier
> > 2. parent_group_id - identifier of parent group
> > I need to select history, from top to wanted group.
> > I can't change the database design and ofcourse this is MySQL
> > 3.23 database.
> > Can somebody help me ?
> >
> > Thanks
> >
> > ____________________________________
> > Daniel Łaś
> > e-direct Polska sp. z o.o.
> > WWW: http://www.e-direct.pl
> > E-mail: daniel.las@stripped
> > 45-072 Opole ul. Reymonta 45
> > tel. +48 77 44 26 073
> > fax. +48 77 44 26 074
> >
> >
> > ---------------------------------------------------------------------
> > 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 <mysql-thread88709@stripped>
> > To unsubscribe, e-mail
> > <mysql-unsubscribe-steve-mysql-mainlist=spamaphobia.com@stripped>
> > 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 <mysql-thread88729@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-daniel=uni.opole.pl@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>

Thread
Tree in SQLDaniel Łaś22 Oct
  • RE: Tree in SQLSteve Meyers23 Oct
    • ODP: Tree in SQLDaniel Łaś23 Oct
      • RE: Tree in SQLSteve Meyers23 Oct
  • Re: Tree in SQLDan Nelson24 Oct