Why do I need “OR NULL” in MySQL when counting rows with a condition

前端 未结 5 677
小蘑菇
小蘑菇 2020-11-30 14:08

There is a question about MySQL\'s COUNT() aggregate function that keeps popping into my head time to time. I would like to get some explanation to why it is working the way

5条回答
  •  半阙折子戏
    2020-11-30 14:56

    I would suggest that you will find the more standard syntax moves better between different database engines and will always give the correct result.

     select count(*)
     from test
     where value = 4
    

    Is the syntax you used a Mysql variant?

提交回复
热议问题