Re: Order by YYYY MM DD in reverse chrono order trouble

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Order by YYYY MM DD in reverse chrono order trouble
Date: 2004-04-24 11:16:15
Message-ID: 9ae4fad2ef01b3eebb7769a43b955c0b@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> I am trying to select distinct dates and order them in the reverse
> chronological order. Although the column type is TIMESTAMP, in this
> case I want only YYYY, MM, and DD back.

If you don't need them separated (which I suspect may be the case),
you can do something like this:

SELECT DISTINCT TO_CHAR(add_date,'YYYY-MM-DD') AS bb FROM tt
ORDER BY bb DESC;

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200404240716
-----BEGIN PGP SIGNATURE-----

iD8DBQFAikzOvJuQZxSWSsgRAgqbAKDC75SQd2aExYaniSJIzovOlVjvCACgyOAl
Q2KMp3YGBkQwy5y4h9r/96A=
=4idZ
-----END PGP SIGNATURE-----

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kent L. Nasveschuk 2004-04-24 15:14:01 Postgres backend to backup system
Previous Message Riccardo G. Facchini 2004-04-24 05:50:22 Re: Trigger calling a function HELP ME! (2)