Re: Selecting tree data

From: "Pat Maddox" <pergesu(at)gmail(dot)com>
To: brian <brian(at)zijn-digital(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Selecting tree data
Date: 2007-10-27 02:25:17
Message-ID: 810a540e0710261925t2b137282tca9a04086b38db89@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/26/07, brian <brian(at)zijn-digital(dot)com> wrote:
>
>
> Pat Maddox wrote:
> > On 10/26/07, brian <brian(at)zijn-digital(dot)com> wrote:
> >
> >>>
> >>
> >>
> >>SELECT * FROM posts ORDER BY root_id, id;
> >>
> >>brian
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 4: Have you searched our list archives?
> >>
> >> http://archives.postgresql.org/
> >>
> >
> >
> > Okay, but what if I want to order by created_at?
> >
> > btw created_at is a timestamp, I just wrote '4pm' to make it a bit
> > easier to read.
> >
>
> SELECT * FROM posts ORDER BY created_a, root_id, id;

That doesn't work because it just sorts by created_at, and then if two
records are the same it goes to root_id. That's not what I want.

Pat

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Reg Me Please 2007-10-27 06:37:59 Re: INDEX and JOINs
Previous Message Paul Boddie 2007-10-27 00:00:38 Re: select count() out of memory