public function consultarPrecios($fecha) { $query = new \yii\db\Query(); $query->select('Producto,Fecha,Tipo,AVG(Pond_Suma) as Pond_Suma')->from('alhondigas')->where('Tipo=:tipo and Fecha=:fecha', array(':tipo' => 'Precios', ':fecha' => $fecha))->groupBy('Producto'); $rows = $query->all(AlhondigasPreciosPonderados::getDb()); return $rows; }