我想在迁移脚本中使用这种查询。
update table1, table2 set table1.column = table2.another_column where table1.id=table2.foreign_id
如何做到这一点的laravel/雄辩的方式?
试试这个:
DB::table('table1') ->join('table2', 'table1.id', 'table2.foreign_id') ->update(['table1.column' => DB::raw('table2.another_column')]);