In the model for selecting minPrice and maxPrice I use subquery, the result is: `

'minPrice' => ProductGroupAttribute::find() ->select(['MIN(pga.price)']) ->alias('pga') ->andWhere('q1.template_id = template.id') ->andWhere([ 'q1.status' => Product::STATUS_PUBLIC, 'c.status' => Company::STATUS_ACTIVE, ]) ->joinWith([ 'product as q1', 'product.company as c', 'product.company.boxberry as b', ],false) ->andWhere([ 'or', ['exists', $queryInUserCity], [ 'and', ['exists', $productPackageSicez], ['exists', $companyBoxberry] ] ]) ` 

same with maxPrice. Is it possible to unite somehow? what one request to select both maxPrice and minPrice? But it takes a very long time to choose up to 6 seconds (

    0