Find the answer to your Linux question:
Results 1 to 2 of 2
MYSQL!! how to order by DESC or ASC with 12-07-2007 10:00:00 (dd-mm-yyyy hh:mm:ss) i store dat-time in birthday filed with varchar type and store data format 12-07-2007(dd-mm-yyyy hh:mm:ss) and try ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    84

    Please !!! MYSQL!! how to order by DESC or ASC with 12-07-2007(dd-mm-yyyy hh:mm:ss)

    MYSQL!! how to order by DESC or ASC with 12-07-2007 10:00:00 (dd-mm-yyyy hh:mm:ss)

    i store dat-time in birthday filed with varchar type and store data format 12-07-2007(dd-mm-yyyy hh:mm:ss) and try to query order by desc or asc not working

    How to

    1. my field store date-time that varchar and (dd-mm-yyyy hh:mm:ss) only

  2. #2
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    You should consider changing that field data type. The date format is valid for youse with datetime.

    In the meantime -

    Code:
    select cast($columname As DateTime) "Time" order by 1 desc
    Where $columname is your varchar column you want as datetime, "Time" is an alias you are giving it and it is ordered descending by column 1 (out of one column).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...