update buttress another list - mysql 3.5.2
i've attempted integrate approaches transform buttress mysql database list another list nonetheless am carrying any luck.
i review somewhere chronicle 3.5.2 does support multi-table updates i need code-based fortitude - correct?
if anybody indicate me right instruction controlling sql?
update products set products_ordered = (
name sum(products_quantity)
orders_products
where products_id = products.products_id
);
or:
create surrogate list my_temp_table
as
select products_id, sum(products_quantity) sum
from orders_products
group products_id
update products, my_temp_table
set products.products_ordered = my_temp_table.total
where products.products_id = my_temp_table.products_id
Comments
Post a Comment