how to achieve latest record group by.
$query = Ledgerbillbalance::find();
$query->select(['id','MAX(id) AS asd','name','balance','date']);
$query->andWhere(['<','id','asd']);
$query->groupBy(['name','guid']);
$query->orderBy('Max(id) AS DESC');
i tried withandwhere and i tried with orderBy also,but nothing is working.