Re: sort by date

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Richard.

That did the trick. Now to the DB fixing business...

-Will

"Richard Lynch" <ceo@xxxxxxxxx> kirjoitti 
viestissä:3955.24.136.1.28.1115610399.squirrel@xxxxxxxxxxxxxxxx
> On Thu, May 5, 2005 10:42 pm, William Stokes said:
>> I made a mistake and stored date information to DB as varchar values
>> (dd.mm.yyy). When I read the DB is it still possible to sort the data by
>> date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the
>> date information to be stored as a date in the DB? Will it work or is the
>> output going to be sorted randomly?
>
> As noted, your best solution is to fix the database.
>
> A short-term hack would be to:
> order by substring(your_field, 6, 4), substring(your_Field, 3, 2),
> substring(your_field, 1, 2)
>
> Read the MySQL manual to check the actual numbers for substring in MySQL
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux