Yusuf Gangat wrote: > > Hi guys > > I am having a bit of a problem. I have the following query to sum the > amounts in a table : > select sum(amount) from transactionfile where sub_account = '6000' and > transactiondate >= '2004-02-1 00:00:00' and transactiondate <= > '2004-02-29 00:00:00' and amount >0 and transactionstatus = 0 > > The amount I get is 4152482.86. > > However, if I run the following query : > select amount from transactionfile where sub_account = '6000' and > transactiondate >= '2004-02-1 00:00:00' and transactiondate <= > '2004-02-29 00:00:00' and amount >0 and transactionstatus = 0 > > which gives me the individual amounts and I manually sum them I get an > amount of 4152488.90 which is out by 6.04 in comparison to the first > query. > > Does anyone know what could be causing this? Is it possible that it > might be a bad index?
If we knew if and which indexes you have for this table and if we knew the result of explain for your select we had a chance to answer this. Please tell us the version you are using, the indexes defined for this table, the result of the explain, what happens with the select -result after ALTER INDEX <the index-name of the index used according to the explain-result> DISABLE: the new explain-result and the new sum-result-value. Elke SAP Labs Berlin > > Any help will be appreciated! > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.577 / Virus Database: 366 - Release Date: 2/3/2004 > > -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
