php - Yii2 uses a sql statement to batch update instead of looping inserts. How to achieve this?
漂亮男人
漂亮男人 2017-05-17 09:55:39
0
1
782

Yii implements the following batch insertion method. If it is batch update, is there the same implementation method in Yii2?


Yii::$app->db
    ->createCommand()
    ->batchInsert($table, $columns, $rows)
    ->execute();

Batch update is a method of using a SQL statement to implement batch updates instead of cyclic updates, e.g:

UPDATE order
    SET field = CASE order_no
        WHEN 1 THEN 'value'
        WHEN 2 THEN 'value'
        WHEN 3 THEN 'value'
    END
WHERE order_no IN (1,2,3)
漂亮男人
漂亮男人

reply all(1)
Ty80

replace into

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!