How to get a count even if there are no results corresponding mysql?

后端 未结 4 735
暗喜
暗喜 2020-12-11 02:47

I am formalating a query to give the number of reports submitted over the last year ordered by date. I get the current year and month with php:

$year = date         


        
4条回答
  •  独厮守ぢ
    2020-12-11 03:26

    count(col_name) AS count will give you count 0

    For reference you can visit http://www.mysqlperformanceblog.com/2007/04/10/count-vs-countcol/

提交回复
热议问题