Search code examples
sqlsql-updatelaravel-9

PHP Laravel how to make mass update where one column value will update another column


I need to make simple thing but in Laravel standards.

UPDATE xxx_table SET col2 = col1

Thats all. Can not find proper method in DB facade.


Solution

  • The solution I found is

    DB::update(['col2' => DB::raw('col1')]);
    

    Its little weird to me.