2015-09-09 58 views
4

如何根據我的條件更新所有記錄? (我的代碼是不行的)Yii2:updateAll多條件

$condition[] = ['>', 'position', $old_position]; 
$condition[] = ['<=', 'position', $new_position]; 
$condition[] = ['in', 'id', $ids]; 

Video::updateAll([ 
    'position' => new \yii\db\Expression('@a := @a + 1'), 
], $condition); 

回答