开发者

MySQL query for sorting by multiple date values

I'm creating a PHP script that fetches IDs from a database. The results are sorted by two datetime values, createdon and publishon.

The priority of publishon is higher than createdon; however, publishon may also be NULL. publishon = null => sort by creat开发者_如何学运维edon.

Can someone help me sort those rows?


ORDER BY IFNULL(PublishOn, CreatedOn), CreatedOn
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜