php mysql order by timestamp is incorrect

后端 未结 2 1229
说谎
说谎 2021-01-29 12:05

I have database records such as below

Name Date(timestamp) Time(timestamp)

I want to order them by time DESC. But it shows me incorrect order.

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-29 12:45

    Try to use Timestamp() for specifying that you expect the fields you wanna extract data from as timestamps.

    something like this:

    SELECT timestamp( `timestamp` ) as 'timestamp'
    FROM randomTable
    ORDER BY 1 ASC;
    

    it would be great if you can post screenshots of your output to make the issue clearer.

提交回复
热议问题