sql - db2 select statement with group and sum -


i have data in db2 need query for...

location | part | quantity --------------------------   loc1     td3     300   loc1     ra5       0   loc2     mo2       8   loc2     cy1       9   loc2     bl5       6   loc4     ra5      50   loc4     pl5       5   loc3     yt7       2   loc3     ua9       5 

the result set return 'location's have less 10 'quantity' of 'part's. 'part' doesn't need included in result set. in result set, sum total of quantities well. in case above, result set.

location | total quantity -------------------------   loc2          23   loc3          7 

this needs sql query database db2

i see. isn't quite duplicate of last question. minor tweak on query:

select location, sum(quantity) db2 group location having max(quantity) < 10; 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -