9 messages in com.mysql.lists.mysqlRe: Re: Order by date
FromSent OnAttachments
Nick Wilson07 May 2002 02:06 
Victoria Reznichenko07 May 2002 04:45 
Nick Wilson07 May 2002 06:00 
James Fidell07 May 2002 06:09 
Jay Blanchard07 May 2002 06:31 
Victoria Reznichenko07 May 2002 06:37 
Nick Wilson07 May 2002 06:49 
Tahir Ata Barry07 May 2002 07:14 
Nick Wilson07 May 2002 07:29 
Subject:Re: Re: Order by date
From:Nick Wilson (ni@explodingnet.com)
Date:05/07/2002 07:29:11 AM
List:com.mysql.lists.mysql

-----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, "; ^^^^^^^^^^^^^^^^ The result of DATE_FORMAT() function is a string. So, in ORDER BY clause is used string 'date'. That is why you get "wrong" sorting. Use another alias for your date column, it should help you, i.e.:

Yes! How strange, the penny dropped whilst I was making a cup of tea and I was sure I had it. Now I /know/ I do. Many thanks Victoria :-) sql - -- Nick Wilson // www.explodingnet.com

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE81+GXHpvrrTa6L5oRAuMXAJ0clmtEYrYscsNlNgCktrN5AlPDfwCffgWS bfCr8rkBNl4YwtNo7TAbbWY= =/rKf -----END PGP SIGNATURE-----