Posted by J.O. Aho on 10/11/30 11:45
Mark D. Smith wrote:
> Hi
>
> i have some data which i can read ok but i need to display by date posted.
> Problem is the date is stored in a field as text DD/MM/YY
>
> using ORDER BY date_posted ASC does not give desired effect as it seems to
> use only the DD
>
> example of current output.
>
> 05/04/06
> 05/04/06
> 05/04/06
> 05/04/06
> 16/01/06
> 16/01/06
> 22/03/06
> 23/03/06
> 24/03/06
>
> is there a way (otherthan re writing all the dates in database) to sort the
> dates by order ?
Whats the datatype for the column? It seems like it's not of the type DATE
which had sorted it correctly from the beginning.
One way would be trying to alter the type of the column to DATE, this may
involve that you have to store the dates and id in a temporary table.
http://dev.mysql.com/doc/refman/5.0/en/datetime.html
http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
//Aho
Navigation:
[Reply to this message]
|