forcing date ordering

Поиск
Список
Период
Сортировка
Искать

forcing date ordering

От:
"tab view" <tabview@hotmail.com>
Дата:
When I do the following piece of SQL

SELECT DISTINCT to_char(datetimelogged,'dd/mm/yyyy') AS datelogged FROM 
logins ORDER BY datelogged DESC;

I don't seem to get the column sorted in date order. How do I force psql to 
use date order?

Nige

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

Re: forcing date ordering

От:
Michael Glaesemann <grzm@myrealbox.com>
Дата:

On Sep 6, 2004, at 10:21 PM, tab view wrote:

> SELECT DISTINCT to_char(datetimelogged,'dd/mm/yyyy') AS datelogged 
> FROM logins ORDER BY datelogged DESC;
>
> I don't seem to get the column sorted in date order. How do I force 
> psql to use date order?

What is the data type of the datetimelogged column?

Michael Glaesemann
grzm myrealbox com

Re: forcing date ordering

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"tab view"  writes:
> When I do the following piece of SQL
> SELECT DISTINCT to_char(datetimelogged,'dd/mm/yyyy') AS datelogged FROM 
> logins ORDER BY datelogged DESC;

> I don't seem to get the column sorted in date order.

I'd expect that to produce a textual sorting of the to_char strings.

> How do I force psql to use date order?

Sort by the underlying datetimelogged column, which I suppose is of
date or timestamp type ...

			regards, tom lane
FAQ