Answer the question
In order to leave comments, you need to log in
How to work with aliases in Yii2?
There is a sample
$stats = Viewstat::find()
->select([
'count(prod_id) AS prodCount',
'daystat'
])
->where(['prod_id' => $id])
->groupBy('daystat')
->one();
print_r($stats['prodCount']);
Answer the question
In order to leave comments, you need to log in
$stats = Viewstat::find()
->select([
'prodCount'=>'count(prod_id)',
'daystat'
])
->where(['prod_id' => $id])
->groupBy('daystat')
->one();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question