Search Postgresql Archives

Re: Order By Date Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In response to BlackMage <dsd7872@xxxxxxxx>:

> 
> I have a question about ordering by date. I have a table with two fields and
> some date
> 
> Name(character varying)  |  Event_Date(timestamp with timezone)
> A                                  |    2009-09-10 5:30:00
> B                                  |    2009-09-10- 00:00:00
> C                                  |    2009-09-11 17:30:00
> D                                  |  2009-09-11  07:30:00
> 
> 
> I want to order by date and then by name, so I want the result A,B,C,D. The
> problem is when I do a 'SELECT * FROM table_name ORDER BY Event_Date, DESC',
> it includes the actual time (HH:MM:SS) so the order comes out B,A,D,C.
> 
> So what I am asking is how do I order only by the date? YYYY-MM-DD?

You could do "ORDER BY event_date::DATE"

-- 
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux