replace this –
FROM
t_unities q
LEFT OUTER JOIN t_release t ON t.tUnity=q.tUnity
WHERE
LEFT ( t.tUnity, 2 ) = LEFT ( 'd400', 2 )
AND tMonthYear = '1-2021';
with this –
FROM t_unities q
LEFT OUTER
JOIN t_release t
ON t.tUnity = q.tUnity
AND t.tUnity LIKE 'd4%'
WHERE t.tMonthYear = '1-2021'
please tell my why you want to chop this query into pieces like your other ones