from KOLLECTO.ACCOUNTS ac
JOIN TVER.ACTIVITYCC_REP ar ON ac.CEID = ar.CEID
JOIN KOLLECTO.COLLECTION_ENTITIES ce ON ac.CEID = ce.CEID
JOIN KOLLECTO.GROUP_USER_INT gui ON ce.OWNER = gui.IDUSR
JOIN KOLLECTO.GROUPS g ON g.IDGRP = gui.IDGRP
JOIN users u ON u.IDUSR = gui.IDUSR
WHERE
ce.ZONE IN ('P','H','S','U','W','T','Z','A','L','X','M')
AND (u.ACTIVE = 1 AND u.DELETED != 1)
AND (g.DELETED != 1)
AND g.NAME NOT LIKE '%FIELD%'
AND g.NAME NOT LIKE '%LEGAL%'
)