Re: Ordering YYYY MM DD in reverse chrono order - Mailing list pgsql-general

From Eric Ridge
Subject Re: Ordering YYYY MM DD in reverse chrono order
Date
Msg-id FCC3FDB7-97C8-11D8-A691-000A95BB5944@tcdi.com
Whole thread Raw
In response to Ordering YYYY MM DD in reverse chrono order  (otis_usenet@yahoo.com (OtisUsenet))
List pgsql-general
On Apr 21, 2004, at 5:19 AM, OtisUsenet wrote:
<snip>

> I am using the following query, but it's not returning dates back in
> the reverse chronological order:

<snip>

> ORDER BY
> date_part('year', uu.add_date), date_part('month', uu.add_date),
> date_part('day',  uu.add_date) DESC;

Maybe I'm missing something, but why not just sort by "uu.add_date
DESC", like so:

    ORDER  BY uu.add_date DESC;

Seems like it would be more efficient, and there'd be no issues about
forgetting to put DESC after each date_part() (like you have above).

eric


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: shadowing (like IB/Firebird)
Next
From: Dave Cramer
Date:
Subject: Re: [JDBC] loading data into postgresql became slow