List:General Discussion« Previous MessageNext Message »
From:Michael Dykman Date:September 12 2007 8:54pm
Subject:Re: ordering dates
View as plain text  
May I suggest:

SELECT date_format(date, '%d/%m/%Y') as mydate, title,
id, display FROM news ORDER BY date DESC

changing the alias of your formatted date to mydate, the raw value of
date is now available to order by.

 - michael dykman


On 9/12/07, Ross Hulford <ross@stripped> wrote:
> $result= mysql_query("SELECT date_format(date, '%d/%m/%Y') as date, title,
> id, display FROM news ORDER BY date DESC ");
>
> I have the query above the problem is oders them like so
>
> 30/05/2007
> 29/07/2007
> 25/0/2007
>
>
> The order is taken by the first number. Is there any way to order them
> properly without a timestamp?
>
>
> Ta,
>
> R.
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>


-- 
 - michael dykman
 - mdykman@stripped

 - All models are wrong.  Some models are useful.
Thread
performance of extended insert vs. load dataSid Lane23 Jul
  • Re: performance of extended insert vs. load dataPerrin Harkins23 Jul
  • Re: performance of extended insert vs. load datamos23 Jul
    • Re: performance of extended insert vs. load dataPerrin Harkins23 Jul
  • ordering datesRoss Hulford12 Sep
    • Re: ordering datesMichael Dykman12 Sep
    • Re: ordering datesPhilip Hallstrom12 Sep
    • RE: ordering datesJerry Schwartz12 Sep
Re: performance of extended insert vs. load dataB. Keith Murphy23 Jul
  • Re: performance of extended insert vs. load dataMogens Melander24 Jul
  • Re: performance of extended insert vs. load dataRavi Prasad24 Jul