vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have a table like this order_id price 1 -1000 2 2000 3 3000 4 4000 I want to know the total of the order amount, I use this query SELECT SUM(price) FROM MyTable and I get 8000 instead of 9000. The negative value seems to be read twice! Do you have an idea? Thanks a lot |
| ||||
| Jean-Claude wrote: > I have a table like this > > order_id price > 1 -1000 > 2 2000 > 3 3000 > 4 4000 > > I want to know the total of the order amount, I use this query > > SELECT SUM(price) > FROM MyTable > > and I get 8000 instead of 9000. The negative value seems to be read twice! > > Do you have an idea? > Thanks a lot 4 + 3 + 2 = 9 9 - 1 = 8 Where is the problem? |