Problems with Where

1

I'm using MariaDB and I have a problem in the WHERE clause of the bank.

The query is inside Excel which brings me periods from the bank through the month filter. But I was asked to change for a period of time, but it is bringing me an empty table and I can not understand why.

FROM
perfilacoes_table
WHERE
fila_atendimento regexp "DENTALUNIGRC" and
month( date_format(STR_TO_DATE(perfilacoes_table.data_inicio_chamada, '%d/%m/%Y'), '%Y-%m-%d') ) > month( DATE_ADD(date_format(curdate(), '%Y-%m-%d'), INTERVAL -1 DAY) ) -1 and
month( date_format(STR_TO_DATE(perfilacoes_table.data_inicio_chamada, '%d/%m/%Y'), '%Y-%m-%d') ) <= month( DATE_ADD(date_format(curdate(), '%Y-%m-%d'), INTERVAL -1 DAY) ) and
date_format(STR_TO_DATE(perfilacoes_table.data_inicio_chamada, '%d/%m/%Y'), '%Y-%m-%d') < DATE_ADD(date_format(curdate(), '%Y-%m-%d'), INTERVAL 0 DAY)
ORDER BY
date_format(STR_TO_DATE(data_inicio_chamada, '%d/%m/%Y'), '%Y/%m/%d') desc;

This version brings me information, but I need to change it so I changed it to:

FROM
perfilacoes_table
WHERE
fila_atendimento regexp "DENTALUNIGRC" and
perfilacoes_table.data_inicio_chamada BETWEEN CAST('2018-12-01' AS DATE) AND CAST('2018-12-31' AS DATE)
ORDER BY
date_format(STR_TO_DATE(data_inicio_chamada, '%d/%m/%Y'), '%Y/%m/%d') desc;

But it brings me an empty table.

There are other querys that have done the same procedure and worked correctly.

I'm not understanding why one value is in one and not another.

    
asked by anonymous 14.12.2018 / 16:01

0 answers