string(620) " FROM tabportaria P INNER JOIN tabtipoportaria T ON (P.TipoPort = T.IdTipoPortaria) LEFT JOIN tabvereador V on (P.NVereador = V.IdVereador) LEFT JOIN (SELECT NPortaria, GROUP_CONCAT(v.Nome separator ', ') as nomeColetiva, GROUP_CONCAT(NCargo) as coletivaCargos FROM tabportariasub s inner join tabvereador v on (s.NAgente = v.IdVereador) group by NPortaria) pc on (pc.NPortaria = P.IdPortaria) where (Site = '' OR Site IS NULL OR Site = 'S') AND (t.VPortaria = '' OR t.VPortaria IS NULL OR t.VPortaria = 'S') AND P.DtDelete IS NULL"