Re: Query on a sorted list (recursive/unary relationship)

From: Alan <not.me_at_uhuh.rcn.com>
Date: Mon, 07 Jun 2004 01:09:56 GMT
Message-ID: <EfPwc.8748$321.3617_at_nwrdny02.gnilink.net>


Google on "celko nested sets".

"Michael Fuchs" <fuze-YOUKNOWWHATTODOWITHTIHS-_at_gmx.net> wrote in message news:c9vsj6$49r$1_at_bird.wu-wien.ac.at...
> Alan wrote:
> > I don't know. You never mentioned what you wanted to sort by, and I am
still
> > not sure looking at your description. Note that you cannot order by the
way
> > the data is stored in the table. It is a set, and by definition is not
> > ordered.
>
> I agree on what you say. As there is no 'natural' order, I introduced an
> artificial one. It is designed as a recursive relationship. The ParentID
> only stores the information on what node is superior.
>
> The question is not as simple as on what colum I should use the ORDER BY
> clause.
>
> I think I remember something like START WITH - CONNECT BY on Oracle
> which might do the trick. (Unfortunately I do not have Oracle but
> MySQL.) So are there any standard SQL workarounds for this?
>
> Thanks,
> Michael
Received on Mon Jun 07 2004 - 03:09:56 CEST

Original text of this message