开发者

How to subtract each item from a table ( sql server 2008)

开发者 https://www.devze.com 2023-04-11 21:17 出处:网络
The actual tables.. The top left is the assembly table The top right is the items_table the bottom left is the inventory table

The actual tables..

The top left is the assembly table

The top right is the items_table

the bottom left is the inventory table

How to subtract each item from a table ( sql server 2008)

How to subtract each item from a table ( sql server 2008)

I wanted to update the inventory based on the orders..开发者_如何学编程

each product has multiple inventory items and I need to multiple each quantity in assembly_table by the quantity in items_table


You could join the tables together to multiply quantities with the same product_tuid:

select  a.product_tuid
,       a.quantity * i.quantity as QuantityProduct
from    assembly_table a
inner join
        items_table i
on      i.product_tuid= a.product_tuid
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号