sql server - SUM from Select query then Show as another Column -
i have table hold several products
and table holds order each product above
how can combine these tables , sum of each ord_count per item , show column, this
to summarize it, have items table holds different products, , orders table holds orders each product items table, want have query combines both tables , show stock each item items table.
try this:
select sum(ord_count) item_stock, itm_code yourtable group itm_code
to combine both table:
select sum(b.ord_count) item_stock, b.itm_code yourtable1 inner join yourtable2 b on a.itm_code = b.itm_code group b.itm_code
Comments
Post a Comment