sql server - SUM from Select query then Show as another Column -


i have table hold several products

enter image description here

and table holds order each product above

enter image description here

how can combine these tables , sum of each ord_count per item , show column, this

enter image description here

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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -