Query in mysql grouping by days with count returning value 0 if there is no day

2

Good morning I'm doing a query in db like this:

SELECT IFNULL(COUNT(*), 0) as numero, DAY(cdr.calldate) as dia, MONTH(cdr.calldate) as mes, YEAR(cdr.calldate) as ano FROM cdr LEFT JOIN peers on cdr.dst = peers.name WHERE cdr.calldate >= '2018-08-01 00:00:00' and cdr.calldate <= '2018-08-23 23:59:59' and length(src) > 5 and dcontext = 'default' and (cdr.dst like '2209' OR cdr.dstchannel like 'KHOMP/b0c9%') GROUP BY DAY(cdr.calldate)

It brings me the following result:

numero  dia mes ano
4       1   8   2018
14      6   8   2018
20      7   8   2018
10      8   8   2018
19      9   8   2018
10      10  8   2018
17      13  8   2018
9       14  8   2018
13      15  8   2018
9       16  8   2018
10      17  8   2018
10      20  8   2018
16      21  8   2018
3       22  8   2018
1       23  8   2018

Please note that it does not take a few days because there is no information these days. I already searched the internet and could not make bring the days that do not have results as value or count. Does anyone know how to do it? or can you tell me the function name in mysql or command that returns that?

    
asked by anonymous 23.08.2018 / 15:02

0 answers