Yii2 find distinct issue

Hello Yii2 Guru’s,

I have issue to show distinct record using MyModel::find()

I want to show distinct record on the behalf of customerID

I used this query but noting happens.

$query = ProviderCustomer::find()->select(['companyID','providerID', 'customerID'])->distinct();

Please see my attached screenshot.

in customer.png 2nd Employee Custome is comming two times, and its customerID is 33

Advance thanks for your help.


This link may be useful to you.


Thanks I got the solution:

$query = ProviderCustomer::find()->select('customerID')->distinct();