Skip to content
Advertisement

updating data in a table from another table

I have two tables:
cart_item

product

How to correctly update the data in the product table based on the data in the cart_item table? I want to update the quantity of products in the table product.
By updating the data in product I will delete all products in the table cart_item. Here is what I would like to get when updating the data:
product

Advertisement

Answer

You can try to use UPDATE ... JOIN to calculate the value.

sqfliddle

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement