We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Find distinct not working

Hi,

why is this not working?

    $country = new Select(
            "country",
            Country::find(['distinct' => 'country', 'order' => 'country']), 
            ["using" => ["country", "country"],
            'class'=> "form-control"]
        );
    $country -> setLabel('Country');
    $this->add($country);

order is working but distinct not.



145.0k
Accepted
answer
edited Dec '16

Beacause there is no such argument as distinct.

Try to use:

'columns' => 'DISTINCT country'


59.9k

Yes, thx Wojciech :-)

Maybe he got confused with the aggregate examples in the docs here.



59.9k

Yes Nikolay, i took this example from the docs.