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

From: Michael Fuchs <fuze-YOUKNOWWHATTODOWITHTIHS-_at_gmx.net>
Date: Sun, 06 Jun 2004 21:57:46 +0200
Message-ID: <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 Sun Jun 06 2004 - 21:57:46 CEST

Original text of this message