Re: Sorting distinct dates by year and month respectively - Mailing list pgsql-novice

From Matt Arnilo S. Baluyos (Mailing Lists)
Subject Re: Sorting distinct dates by year and month respectively
Date
Msg-id d1a6d7930606071136y53b5ddd2kbdbb659ca2e51bf5@mail.gmail.com
Whole thread Raw
In response to Re: Sorting distinct dates by year and month respectively  (Richard Broersma Jr <rabroersma@yahoo.com>)
List pgsql-novice
On 6/7/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> You want
>         ... ORDER BY date_part('year', article_pubdate) DESC,
>         date_part('month', article_pubdate) DESC;
> As noted by the other respondent, sorting on one date_trunc column is
> probably the better way to do it, but I thought I'd point out the DESC
> issue anyway.  A lot of people get that wrong.

On 6/7/06, Richard Broersma Jr <rabroersma@yahoo.com> wrote:
> you should specify asc or desc for both columns to insure the desired result.

Thanks Tom and Richard. It works as intended now. Learned something new today.

--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

pgsql-novice by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: Sorting distinct dates by year and month respectively
Next
From: "Florian Reiser"
Date:
Subject: Re: Why do I need an Account to install the PostGreSQL?