Hello I'm using phalcon Framework.
I need to make a find, normally I would use distinct, but I not found an option.
My class as below :
class Calls extends \Phalcon\Mvc\Collection {
public $agent;
public $number;
public $date;
public $status;
}
I need to use distinct fields date and number ?
you should use query builder:
Basic implementation for later example:
$queryBuilder = $this->getDI()->getModelsManager()
->createBuilder()
->addFrom('tableName', 't');
Distinct command:
$queryBuilder->distinct('t.id');
Column thing works too, but not recommended:
$queryBuilder->columns('DISTINCT(t.id) AS id')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With