This is a discussion on To query SUM of multiple row of the same key id within the MySQL forums, part of the Database Server Software category; --> Hi, Pls help What query I should use to get the SUM of this example EjenID ProductID Amount Month ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, Pls help What query I should use to get the SUM of this example EjenID ProductID Amount Month 1 41 2 9 2 40 2 9 1 40 3 9 2 41 2 9 1 42 2 10 how can I get the result of this: to view the EjenID total Amount of purchase in Month=9 look like this EjenID Amount Month 1 5 9 2 4 9 thanx |
| |||
| muadzir@yahoo.com wrote: > Hi, > > Pls help > > What query I should use to get the SUM of this example > > EjenID ProductID Amount Month > 1 41 2 9 > 2 40 2 9 > 1 40 3 9 > 2 41 2 9 > 1 42 2 10 > > how can I get the result of this: to view the EjenID total Amount of > purchase in Month=9 > > look like this > > EjenID Amount Month > 1 5 9 > 2 4 9 > > thanx > SELECT EjenID, SUM(Amount), Month FROM table_name WHERE Month = 9 GROUP BY EjenID, Month |