Answer the question
In order to leave comments, you need to log in
How to get the sum of a table with a condition in Yii2 using AR?
I'm trying to get the sum of records from a table with a date condition.
The code is the following:$reportDate = '2015-10-01';
$saldo = Transaction::find()
->sum('')
->andWhere('<', '', $reportDate)
;
Answer the question
In order to leave comments, you need to log in
The ->andWhere method is used when the ->where method has already been used.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question