Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.



106.7k
Accepted
answer
edited Dec '16

Beacause there is no such argument as distinct.

Try to use:

'columns' => 'DISTINCT country'


19.5k

Yes, thx Wojciech :-)

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



19.5k

Yes Nikolay, i took this example from the docs.