Some time you want to update a column in a table from another table’s column and in magento 2 you can use “updateFromSelect” function to do it.
- This is an example in resouce model
|
- And this is the query after the code is render
1 2 3 4 5 6 7 |
UPDATE `maintable` AS `maintable` INNER JOIN `maintable` LEFT JOIN `'join_table'` AS `'join_table'` ON main_table.id = 'join_table'.id SET `'main_table'`.`name` = `'join_table'`.`name` |
Hope it helpful for you.
The steps I mention above is the shortest process for you to Update a Column in a Table from Another Table’s Column in Magento 2.
Thank you for reading this post and see you in other posts from Magestore!
Your Magento website needs a powerful Magento ERP for stock control.
DON'T MISS THE CHANCE!