I have the following query:
SELECT
numero,
sistema,
status,
date_first_queued
FROM
ocorrencias
HAVING DATE(date_first_queued) between DATE_FORMAT(CURDATE() ,'%Y-%m-01') AND CURDATE()
AND sistema = '17'
It returns me the records perfectly, but I want to use a count
with it, except that it returns empty, it follows my query with count
:
SELECT
COUNT(numero),
numero,
sistema,
status,
date_first_queued
FROM
ocorrencias
HAVING DATE(date_first_queued) between DATE_FORMAT(CURDATE() ,'%Y-%m-01') AND CURDATE()
AND sistema = '17'
I even need to use group by
more when I put group by
of the following error below: