首先,目标记录是存在的

SELECT * FROM d_device_user_bind dub WHERE dub.`uid`='222222222221'

其次,

SELECT dub.uid,dub.`device_id`,IF(IFNULL(dub.`device_id`,2)=2, 2, 1) isActivate FROM d_device_user_bind dub WHERE dub.del_flag=0 ORDER BY dub.`create_time` DESC LIMIT 8;

换一个语句:  SELECT dub.uid,dub.`device_id`,IF(dub.`device_id` IS NULL OR dub.`device_id`='', 2, 1) isActivate FROM d_device_user_bind dub WHERE dub.del_flag=0 ORDER BY dub.`create_time` DESC LIMIT 8;

再一个写法: SELECT dub.uid,dub.`device_id`,IF(ISNULL(dub.`device_id`), 2, 1) isActivate FROM d_device_user_bind dub WHERE dub.del_flag=0 ORDER BY dub.`create_time` DESC LIMIT 8;

不知道为什么会这样,也许是mysql的一个bug吧。

最新文章

  1. 转移博客到xinqiyang.freeflare.com了,这里会继续更新.
  2. Linux umount设备时出现device is busy解决方法
  3. This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
  4. javascript垃圾回收机制
  5. Linux下软件包的多种安装方式
  6. html_
  7. python 安装scrapy
  8. HDU 4539 郑厂长系列故事——排兵布阵
  9. SQLSERVER数据库管理数据库原理
  10. 三菱plc输出指示灯不亮怎么办(转载)
  11. Unity Flow distort of screen
  12. js获取当前url地址及参数
  13. JQ对JSON的增删改
  14. undefined与null
  15. CentOS 引导 Win10 启动项
  16. python中的异常
  17. Python基础(生成器)
  18. QIDO-RS - Search
  19. centos linux查看硬盘型号
  20. HTML5实现全屏API【进入和退出全屏】

热门文章

  1. 执行SQL时出现: ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
  2. 5(计算机网络)从物理层到MAC层
  3. 为常用的块类型创建typedef
  4. 二十 Spring的事务管理及其API&事务的传播行为,编程式&声明式(xml式&注解式,底层AOP),转账案例
  5. 【剑指Offer面试编程题】题目1522:包含min函数的栈--九度OJ
  6. zabbix开启对中文的支持--&&--中文乱码解决方法
  7. java并发之Future与Callable使用
  8. input文件类型上传,或者作为参数拼接的时候注意的问题!
  9. Day10 - C - Blow up the city HDU - 6604
  10. 1-3SpringBoot之Controller使用