string(470) " FROM tabarquivos A LEFT JOIN tabcompetencia cp on (A.NComp = cp.IdComp), tabtipoarq T, tabcatarq C WHERE ((A.NTipoArq = T.IdTipoArq) or (A.NTipoArq IS NULL) ) AND ((T.NTipoCat = C.Id) or (T.NTipoCat IS NULL)) AND A.DtDelete IS NULL AND NTipoArq IN (SELECT IdTipoArq FROM TabTipoArq WHERE IdTipoArq > 0 AND NTipoCat = 2 )"