php - How to update from subquery using Laravel Query Builder -


update table  set id  ='999' seq = ( select seq table id null order seq limit 1) 

please teach me

using query builder

$subquery = db::table('table')     ->select('seq')     ->wherenull('id')     ->orderby('seq')     ->take(1)     ->tosql();  $query = db::table('table')     ->whereraw("seq = ($subquery)")     ->update(['id' => 999]); 

raw query:

$sql = 'update table set id = 999 seq = (select seq table id null order seq limit 1)'; db::statement($sql); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -