search

Home  >  Q&A  >  body text

MySQL 使用 group by 之后然后 IFNULL(COUNT(*),0) 为什么还是会获得 null

如题

MySQL 使用 group by 之后然后 IFNULL(COUNT(*),0) 为什么还是会获得 null。

 SELECT IFNULL(count(max_choose_number),0)   FROM t_paper_**** tps WHERE tps.paper_id = 210 AND tps.structure_type = 4 GROUP BY tps.paper_id

结果为 null

阿神阿神2788 days ago850

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 15:18:08

    In this case, there is generally no data that satisfies the where condition. Therefore, null is returned.

    reply
    0
  • Cancelreply