Thank you Steve, I'm using a distinct count indeed! Couldn't this be transformed with a count(distinct concat( tbl1_.id1, tbl1_.id2 )) or count(distinct checksum( tbl1_.id1, tbl1_.id2 ))?