I have two Orders tables and Order_Details Order_Details table order_id field acts as a foreign key in the Orders table id_order table.
I want to update the price_total field of the price_total table with the summation of prices from the Order_Details table.
I tried to execute the following query but could not: -
Update Orders, Order_Details SET Orders.price_total = sum(Order_Details.price) WHERE Orders.price_total=0 GROUP BY Order_Details.id_order
Mistake -
How to do it in one request?
thanks
join mysql group-by sum
Sandeepan nath
source share