Re: ordering date in varchar

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

 



> I think you can try the SQL:
> Select STR_TO_DATE([field_name], '%d/%m/%Y') as newDate , [field_name] from [table] order by newDate asc;
> 
> Thanks,
> Haitao
> 
> 
> -----Original Message-----
> From: Vaibhav Informatics [mailto:vaibhavinformatics@xxxxxxxxx] 
> Sent: 2008年3月13日 16:36
> To: php-db@xxxxxxxxxxxxx; php-db-digest-sc.1196674013.gdgkepajakejmghdjkad-vaibhavinformatics=gmail.com@xxxxxxxxxxxxx; php-db-digest-help@xxxxxxxxxxxxx
> Subject:  ordering date in varchar
> 
> We have a problem. We have given the dates as date.month.year eg 27.12.2007
> The field is named as varchar. We have to arrange ths list of dates in
> ascending order. Can anyone help? Varchar arranges the list by scanning from
> left side. Perhaps scanning from right side will do. How to do it?
> 
> 
For the best functionality and performance you should use date fields
for your database.

-- 
Isaak Malik
Web Developer
isooik@xxxxxxxxx

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux