LPS-46114 We need DISTINCT (as in countByC_G_C_N_D_S_T) because otherwise we will get duplicates when applying permission to the query