Skip to content
  • 首页
  • PHP源码
  • html5网页模板
  • js特效
  • Window软件
  • Mac软件
  • 服务器
  • 其他
Search
源码巴士
  • Sample Page

MySQL 排序将不为空的排在前面,空的排在后面

2019独角兽企业重金招聘Python工程师标准>>>hot3.png

示例:(该部分转载自http://blog.sina.com.cn/s/blog_872758480100xerh.html )

select field1 from table1

order by field1 is not null and filed1 != " desc

使用CI的一个示例:

$this->db->order_by("field1 is not null and field1 != '' desc, id desc");

转载于:https://my.oschina.net/syc2013/blog/181660

文章导航
←怎么去做UTDD(单元测试驱动开发)
虚拟机Ubuntu打开摄像头失败及OpenCV打开摄像头超时的问题→

Copyright © 2022 源码巴士  鲁ICP备19024253号-1