mysql - SQL Sum of different rows -


hi need in making query sum different materials in one.

materialname quantity date
...................... 20 .... 1/1/2010
...................... 10 .... 1/2/2010
b ...................... 30 .... 1/2/2010
c ...................... 20 .... 1/3/2010

for example want sum material , b.

try this. add where clause filter a & b sum quantity per materialname

select materialname,        sum(quantity) sum_quantity   tablename  materialname in ( 'a', 'b' ) group  materialname  

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -