SUM not calculating rght

gosaga20's profile image gosaga20 posted 4 months ago in General Permalink

Good day

ROUND(SUM(Valid Bet Amount), 2) AS TotalBetAmount,

Im using the code above but the query outcome is not right. i have negative and positive value in my column Valid Bet Amount but, when i tried to compare it to our back end its not tally. our backend show -1000 but my query will show 13400?

Can anyone help me to fix this problem? i even compare my data in excel. the excel get it right but my query not. thank you vert much

notHeidi's profile image notHeidi posted 4 months ago Permalink

What data type is Valid Bet Amount (I presume you have got that field name in back-ticks?)

It should probably be DECIMAL(10,2) or similar - if you're using DECIMAL or FLOAT then you will get rounding errors which could mount up quite significantly if your table has a lot of rows.

Please login to leave a reply, or register at first.