write:
order by date desc
DeRyl
- Original Message -
From: "Jerry Swanson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 05, 2004 8:00 PM
Subject: ORDER by date: reverse order
I want to sort by date but the last date appears first. How to write such query?
TH
--
[snip]
I want to sort by date but the last date appears first. How to write
such query?
[/snip]
RTFM ORDER BY theDate DESC
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Xavier,
select
ID,
description,
if (ifnull(date1, 20201231) < ifnull(date2, 20201231), ifnull(date1,
20201231), ifnull(date2, 20201231)) as date
from MyTable
order by date
I didn't test it, but it should work.
Any questions? don't hesitate to ask.
Best regards,
Mikhail.
- Original Mess
Hi.
On Mon 2002-07-29 at 14:24:54 -0400, [EMAIL PROTECTED] wrote:
>
> That's a really weird problem. Perhaps someone else could reproduce it if
> it's a bug in the most recent MySQL.
It's not a bug.
> I can think of an immediate way to solve it; use the type (datetime?),
> which is really a s
Hi,
Change the alias to date_format(date,'%D %M %Y') AS
mydate, so you are sure that you sort by the date
field not my the formatted date. Be aware that if you
sort my the formatted string, MySql is going to treat
it as a string and therefore sort it as a string.
"11th July 2002" < "2st July 20
That's a really weird problem. Perhaps someone else could reproduce it if
it's a bug in the most recent MySQL.
I can think of an immediate way to solve it; use the type (datetime?),
which is really a string 20020729. I don't see how this could be sorted
incorrectly, but check your types.
On Mon
Never mind ... I made a mistake in the SQL statement !!! :-)
Son Nguyen
--- Son Nguyen <[EMAIL PROTECTED]> wrote:
> mysql> desc albums;
> +-+-+--+-+++
> | Field | Type| Null | Key | Default| Extra |
> +
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Victoria Reznichenko declared
> NW> and here is my select:
>
> NW> $qry="SELECT id, module, week, ";
> NW> $qry.="DATE_FORMAT(date, \"%d %m %Y\") as date, ";
>^^^
Quoting Nick Wilson ([EMAIL PROTECTED]):
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
> * and then Victoria Reznichenko declared
> > NW> I've been searching for a solution to the following:
> >
> > NW> Is there an easy way to order by date ( - MM - DD), at the moment my
> > NW>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Jay Blanchard declared
> If the date is in the format above you can select a substring
> +++
> | field1 | rDate |
> +++
> | 1 | 2002-03-01 |
> | 2 | 2002-03-03 |
> | 3 | 2002-
Nick,
Tuesday, May 07, 2002, 4:01:09 PM, you wrote:
>> What is your column type? Why you don't use ORDER BY your_date_column
>> in the SELECT statement? It should work, but I can say you exactly
>> because I don't know your table structure. The other causes of wrong
>> result might be that someth
[snip]
>> NW> Is there an easy way to order by date ( - MM - DD), at the moment
my
>> NW> results are coming back with the *day* ordered but not the whole date
>> NW> like this:
>>
>> NW> 02 02 2002
>> NW> 03 03 2005
>> NW> 18 02 2003
>>
>> NW> See what I mean?
>>
[/snip]
If the date is in th
Hello!
May be you are using data as text field or date is being stored in 3 separate columns.
Tell me if I am right. You will
need to store the date as date data type and will be automatically sorted.
Regards
~~~
Tahir Ata Barry
BestPriceHost.com
The Hosting With 3 MySQL Databases
~~~
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Victoria Reznichenko declared
> NW> I've been searching for a solution to the following:
>
> NW> Is there an easy way to order by date ( - MM - DD), at the moment my
> NW> results are coming back with the *day* ordered but not the
Nick,
Tuesday, May 07, 2002, 12:06:31 PM, you wrote:
NW> I've been searching for a solution to the following:
NW> Is there an easy way to order by date ( - MM - DD), at the moment my
NW> results are coming back with the *day* ordered but not the whole date
NW> like this:
NW> 02 02 2002
NW>
Hi,
Wakan wrote :
>
> Hi,
> I've noticed this problem, even if I don't know if it's really a mysql problem:
> if I store a date in standard format, in a date field, all kinds of
> ordering are OK.
> But if I change the output format with: DATE_FORMAT(data,'%d-%m-%Y'),
> the order by clause attem
Wakan <[EMAIL PROTECTED]> wrote:
> But if I change the output format with: DATE_FORMAT(data,'%d-%m-%Y'),
> the order by clause attempt to order the new format incorrectly, because
> I've an output like this: 12-2-2002, 12-3-2002, 12-4-2002, and 13-2-2002!!!
> What can you say about this?
Can you
> But if I change the output format with: DATE_FORMAT(data,'%d-%m-%Y'),
> the order by clause attempt to order the new format
> incorrectly, because
> I've an output like this: 12-2-2002, 12-3-2002, 12-4-2002,
> and 13-2-2002!!!
I normally do this:
SELECT DATE_FORMAT(datefield,'%d-%m-%Y') as d
18 matches
Mail list logo