Mysql order items by the newest of 2 dates

前端 未结 3 1338
孤独总比滥情好
孤独总比滥情好 2020-12-31 05:33

I have a table with 2 dates - the ADDDATE and UPDATEDATE.
When an item is added, the ADDDATE is the current date and the UPDATEDATE is 0000-00-00.

I need to

3条回答
  •  说谎
    说谎 (楼主)
    2020-12-31 06:05

     ORDER BY IF(UPDATEDATE > ADDDATE, UPDATEDATE, ADDDATE)
    

提交回复
热议问题