Given these tables/fields:
people:
id
socialID
name
peopleStats:
id
socialID
drVisitsAmount
receipAmounts
operationsAmount
Im trying to get last 3 records from peopleStats (ordered by id DESC) for a given array of socialIDs (3 records per each socialID):
$dummyData = PeopleStats::find()
->where(['socialID' => $socialIDs])
->groupBy(['socialID'])
->orderBy(['id' => SORT_DESC])
->limit(3)
->all();
but i just get 3 records and not 3 per each. How can i get this data?
Thank you in advance,