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

From Holger Klawitter
Subject Re: Ordering YYYY MM DD in reverse chrono order
Date
Msg-id 200404261839.33155.lists@klawitter.de
Whole thread Raw
In response to Ordering YYYY MM DD in reverse chrono order  (otis_usenet@yahoo.com (OtisUsenet))
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

You are sorting by three columns, only the last one is desc.

What you need is:

...
order by
    date_part( 'year', uu.add_date ) desc,
    date_part( 'month', uu.add_date ) desc,
    date_part( 'day', uu.add_date ) desc
;

Mit freundlichem Gruß / With kind regards
    Holger Klawitter
- --
lists <at> klawitter <dot> de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAjTtF1Xdt0HKSwgYRAmaDAKCcSo5kEPkn4QJfsFhg9EE0k/dmmwCfa7gB
cUjzCy/X0mJXW0Aooyb7pbE=
=0Fhk
-----END PGP SIGNATURE-----


pgsql-general by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] TPC H data
Next
From: Josué Maldonado
Date:
Subject: Re: Migrating Fox (dbf) to PostgreSQL