I think you want to pursue it like this:
with part1 as (
select groupid, count(distinct typecode) as typecount from testtable
group by groupid),
part2 as (
select groupid, count(distinct typecode) as typecount
from yourdata
group by groupid)
select p1.groupid, p1.typecount
from part1 p1
inner join part2 p2 on p1.groupid = p2.groupid and p1.typecount = p2.typecount
Try rewriting your query as 2 datasets, then see if they match.