SELECT s.zonename as zona, count(l.late) as numero FROM f_late l inner join d_biosuppliers s on (s.d_biosuppliers_tk = l.d_biosuppliers_tk) inner join d_biogroups g on (g.d_biogroups_tk = l.d_biogroups_tk) where l.late >= {latethreshold} and case when {PREPARE::groupname} <>'' then g.groupname IN ({PREPARE::groupname}) else true END group by s.zonename order by numero