select c.TheDate,ISNULL(a.pocet,0) as pocet from (select oj.oj_nazev,n.nak_datum_hlaseni,count(n.nak_id) as pocet from nakaza n join okres_jednotky o on n.ok_kod=o.ok_kod join organizacni_jednotky oj on o.oj_kod=oj.oj_kod where n.typ_hlaseni='N' and n.nak_pohlavi='M' and oj.oj_nazev like 'Jihom%' group by n.nak_datum_hlaseni,oj.oj_nazev) as a right join calendar c on c.TheDate=a.nak_datum_hlaseni where c.TheDate>='2020-03-01' and c.TheDate<'2021-05-05' order by c.TheDate