I'm trying to count how many jobs have more than one task associated with them. There is a table for Jobs and a separate table for tasks. These are linked as JOBS.ID = TASKS.WORKID.
I'm using a select count(*) statement to count where the sequence of tasks is greater than one (eg multiple tasks).
Jobs

tasks

the statement is:
SELECT MONTH(Date) AS statsMonth, YEAR(Date) AS theYear, QuarterNumber,
(SELECT COUNT(*) AS Expr1
FROM JOB LEFT JOIN TASK ON TASK.workId = JOB.id
WHERE (TASK.CatId in ('1','2')) AND (MONTH(JOB.LoggedDate) = MONTH(internal_dates.Date)) AND (YEAR(JOB.LoggedDate) = YEAR(internal_dates.Date)) HAVING COUNT(TASK.sequence) > 1) AS "XX"
FROM internal_dates
WHERE date BETWEEN '2019-12-30 05:03:25' AND '2020-03-30 05:03:25'
GROUP BY MONTH(Date), YEAR(Date), QuarterNumber
ORDER BY theYear desc, statsMonth desc, QuarterNumber desc;
however when I run this query against the data shown I get a count of 2 for statsMonth 3, year 2020
as can be seen from the data, there is only 1 JOB with more than one task eg JOB = 2
I need to report on the number of JOBS that have more than 1 TASK associated with them...