tsql - SQL Server SUM GROUP BY Help -


i have table contains orderid, inventoryid, , quantity -- line items table. database sql server 2008.

what need know how write sql statement returns sums of quantities itemid @ order, not counting orders have larger orderids it. must return orderid, itemid, , total.

any help? thanks!

guess:

select     sum(quantity) total, --"sums of quantities itemid @ order"     orderid, inventoryid --"it must return orderid, itemid"     orderid < (some larger order id value) --"not counting orders have larger orderids" group     orderid, inventoryid 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -