I'm using a SQL query to count machine errors between a date range for each machine type.
Here's my code :
SELECT
machine_type,
COUNT(DISTINCT ID_machine)
FROM
MACHINE
WHERE
ID_MACHINE IN (SELECT DISTINCT MACHINE_ID_machine
FROM TRACE
WHERE (date_file BETWEEN '2020-10-01' AND '2020-10-02')
AND (trace_status = 'OK'))
GROUP BY
machine_type
It's working but shows the data on the whole date range and not for every day in the date range, can someone show me how to split the dates and count for each day in the specified date range, thank you all