Hi all,
We have a column (varchar) that has plain text time and it is indexed.
When I do a query with the index, all the data is in the right order,
but when I user ORDER BY .. DESC, the order is messed up. Example:
By index 1: (date, time, data)
SELECT * from t1;
date (date type) time (varchar)
Daniel Verite a écrit :
> Alexandre Leclerc wrote:
>
>> SELECT * from t1 ORDER BY date, time DESC;
>> date (date type) time (varchar) data
>> 2007-01-30 9h30 d2
>> 2007-01-3017h20 d5
>> 2007-01-3013h45 d4
>> 2007-01-3012h00
Brandon Aiken a écrit :
> As others have said, VARCHAR is the incorrect data type to be using
> here. You should either be using INTERVAL or TIMESTAMP depending on
> what you want. You can even combine date and time into a single
> TIMESTAMP field. Only use VARCHAR when no other data type will d
en
CS/IT Systems Engineer
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Alexandre
Leclerc
Sent: Wednesday, January 31, 2007 10:46 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Ordering problem with varchar (DESC)
Hi all,
We have a column (varchar) tha
Alexandre Leclerc wrote:
Hi all,
We have a column (varchar) that has plain text time and it is indexed.
When I do a query with the index, all the data is in the right order,
but when I user ORDER BY .. DESC, the order is messed up. Example:
By index 1: (date, time, data)
SELECT * from t1;
date
Alexandre Leclerc wrote:
> SELECT * from t1 ORDER BY date, time DESC;
> date (date type) time (varchar) data
> 2007-01-30 9h30 d2
> 2007-01-3017h20 d5
> 2007-01-3013h45 d4
> 2007-01-3012h00 d3
> 2007-01-17 8h
am Wed, dem 31.01.2007, um 10:46:17 -0500 mailte Alexandre Leclerc folgendes:
> Hi all,
>
> We have a column (varchar) that has plain text time and it is indexed.
>
> How can I fix that so that the result is exactly like the first one but
> perfectly reversed in it's order?
Use the right data-t
Hi all,
We have a column (varchar) that has plain text time and it is indexed.
When I do a query with the index, all the data is in the right order,
but when I user ORDER BY .. DESC, the order is messed up. Example:
By index 1: (date, time, data)
SELECT * from t1;
date (date type) time (varchar)