Need to count the results without repeating

Good afternoon!
Tell me how to count the results (but so as to eliminate repetition)
my code is:
surveys = this-> paginate ( this-> Surveys); query = surveys-> count (); this-> set (‘query’, $ query);
Can I use in cakephp3 distinct, and how to use it???

Hi @Aman, to select distinct fields, you need use the distinct() method:

$surveys = $this->paginate($this->Surveys->find('all')->distinct(['columnNeedDISTINCT']));

You can try that ^^ Read more here: Selecting Data