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

From: Alan <not.me_at_uhuh.rcn.com>
Date: Sun, 06 Jun 2004 19:25:06 GMT
Message-ID: <mcKwc.11385$QT3.4387_at_nwrdny01.gnilink.net>


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.

"Michael Fuchs" <fuze-YOUKNOWWHATTODOWITHTIHS-_at_gmx.net> wrote in message news:c9vqkc$467$1_at_bird.wu-wien.ac.at...
> Alan wrote:
> > Use the ORDER BY clause.
>
> OK, but ORDER BY what?
> ORDER BY ParentID gives _not_ the korrekt order.
>
> |----|----------|
> | ID | ParentID |
> |----|----------|
> | 1 | NULL |
> | 2 | 1 |
> | 3 | 2 |
> | 4 | 3 |
> | 5 | 4 |
> | 6 | 5 |
> |----|----------|
>
> now I want switch the IDs 3 and 4
>
> |----|----------|
> | ID | ParentID |
> |----|----------|
> | 1 | NULL |
> | 2 | 1 |
> | 4 | 2 |
> | 3 | 4 |
> | 5 | 3 |
> | 6 | 5 |
> |----|----------|
>
> This now is the order I want to get. Looking at the two colums makes it
> obvious that I can not use the ORDER BY clause on them.
>
> I guess there is no way other than programming the right order in the
> application.
>
> Thank you,
> Michael
Received on Sun Jun 06 2004 - 21:25:06 CEST

Original text of this message