Good day. Please tell me how to make a request that would be considered the sum of the specified fields? I'm doing this
$sum = (new Query())->select('count')->sum('count')->from('vote')->where(['poll_id' => $id]); An error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'count' in 'field list' The SQL was executed was: SELECT SUM (count)
And if you perform such a request
SELECT SUM(count) FROM vote WHERE poll_id=$id in phpmyadmin, the amount counts.
If you make a query without a constructor, and through $sum = Yii::$app->db->createCommand("SELECT SUM(count) FROM vote WHERE poll_id=$id") and do vat_dump ($ sum), it will return NULL . In this case there are no errors.