Re: Sorting distinct dates by year and month respectively

From: "Matt Arnilo S(dot) Baluyos (Mailing Lists)" <matt(dot)baluyos(dot)lists(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Sorting distinct dates by year and month respectively
Date: 2006-06-07 18:36:22
Message-ID: d1a6d7930606071136y53b5ddd2kbdbb659ca2e51bf5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 6/7/06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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(at)yahoo(dot)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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Florian Reiser 2006-06-08 09:31:08 Re: Why do I need an Account to install the PostGreSQL?
Previous Message Richard Broersma Jr 2006-06-07 15:01:38 Re: Sorting distinct dates by year and month respectively