魅力峰值

导航

mysql空值排序

SELECT * FROM lzh_topic_channel_product ORDER BY order_id is null , order_id 

 

 

其中的ORDER BY order_id is null  ,mysql默认生序(asc),false为0 在true(1) 之前

如果使用ORDER BY order_id is null desc, 则空值排在非空之后

不实用is null 也可以使用函数 isnull(order_id)

posted on 2019-02-28 10:31  魅力峰值  阅读(833)  评论(0)    收藏  举报