G
G
gachkydxvbgd2017-10-11 18:27:24
Yii
gachkydxvbgd, 2017-10-11 18:27:24

How to update all records in a table?

How to update all records
Need to multiply
Items::updateAllCounters(['price' => ], $condition);
How to increase all prices by 10 percent and decrease
Let's say prices are 5000/6000
Result when increasing 5500/6600
Result when decreasing 4500/4600

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2017-10-11
@gachkydxvbgd

Increase by 10%:
Reduce by 10%:

Items::updateAll(['price' => new \yii\db\Expression('price * 0.9')]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question