我的项目中有一个 yii2 查询,例如
$query=Car::find()
->andFilterWhere(['in','make_id',array_filter(explode(',', $this->makes))])
->andFilterWhere(['in','model_id',array_filter(explode(',', $this->models))])
->andFilterWhere(['>=', 'price', $this->price_start])
->andFilterWhere(['<=', 'price', $this->price_end])
->andFilterWhere(['>=', ModelYear::tableName().'.year', $this->year_start])
->andFilterWhere(['<=', ModelYear::tableName().'.year', $this->year_end])
->andFilterWhere(['>=', 'kilometer', $this->km_start])
->andFilterWhere(['<=', 'kilometer', $this->km_end])
->andFilterWhere(['like', 'title', $this->title])
而且我还有另一个查询
$command = $connection->createCommand("select A.id,A.make_eng,Count(B.make_id)
from tbl_car_makes A,(**Can i use the first $query here**) as B where A.id=B.make_id group by A.id,A.make_eng");
$data = $command->queryAll();
我如何在指定位置的第二个查询中使用第一个查询
繁花如伊