I have a schematic according to the picture below:
The goal is to update the values of the seller_comission column in the tbl_history table. The tbl_history table already has a few thousand records. The seller's commission is different for each product and the value is registered in the tbl_plans table. The tbl_prod_plan table stores the relationship between plans and products.
Could do loops with php and solve the problem. But the question is how could this update be done just by using sql. The database is MySql.