This clause can only be used for select statements.
If you wish to filter duplicates based of those rows sharing a particular field
or set of fields, you may pass an array of fields to filter on. Beware that
this option might not be fully supported in all database systems.
### Examples:
Filters products with the same name and city
$query->select(['name', 'city'])->from('products')->distinct();
Filters products in the same city
$query->distinct(['city']);
$query->distinct('city');
Filter products with the same name
$query->distinct(['name'], true);
$query->distinct('name', true);
public distinct ( array | Cake\Database\ExpressionInterface | string | boolean $on = [], boolean $overwrite = false ) | ||
$on | array | Cake\Database\ExpressionInterface | string | boolean | Enable/disable distinct class or list of fields to be filtered on |
$overwrite | boolean | whether to reset fields with passed list or not |