Distinct with find()

Hi,

There is a way to do a 'SELECT distinct' with a find() ? Because I dont' want to use a query builder.

Thanks.



46.8k

Use a Query:

$query = new Query("SELECT Distinct Cars.* FROM Cars", $this->getDI());

If you select all fields for a model then it will return a simple Resultset with the models.

Just put DISTINCT before first column name.