如何在kohana查询生成器中创建下面的mysql查询

时间:2014-01-12 13:01:53

标签: kohana

如何在Kohana Db Builder中创建以下查询

SELECT @i:=0;
UPDATE `table_name` 
SET `order` = @i:=@i+1 
where `column_name`= '3337' 

1 个答案:

答案 0 :(得分:0)

尝试分开查询!

$q1 = DB::query(NULL, "SELECT @i:=0");
$q2 = DB::update('table_name')
        ->set(array('order','=',DB::expr('@i:=@i+1')))
        ->where('column_name','=','3337');

$q1->execute();
$q2->execute();