Three tables are connected by foreign key good
I want to create a trigger price=price * number
But my total field in the order form commodity prices in the list of goods number field in order detailed list
And how to through the id link they beg bosses! Save the children put the
I according to the online I wrote a trigger you can help me to modify the
create trigger get_order_price
After the update
On order_
For each row
The BEGIN
The update order_ set order_price=orderitem_pro_num * product_price does
Where order_. Order_id=orderitem. Order_id
End
CodePudding user response:
begin
The update order_
The set order_price=sum ((select product_price does the from product) * (select orderitem_pro_num from orderitem))
The from orderitem as oi, product as p
Where oi. Product_id=p.p roduct_id
Group by order_id.
End
And wrote a database is always reported to the fourth row, I have been wrong
CodePudding user response:
Are there any big!!!!!CodePudding user response:
no one to help me