SUM Problem in MSSQL
-
Hi everybody, I have some numbers. Numbers are ( 0 234,9 -27 0 -55,9 0 0 -59 0 100,72 -26 0 -25,72 0 0 0 -82 0 0 0 0 0 0 -134) I want to this. SELECT SUM(FIELDX) FROM TBLX but result is returning (-2,8421709430404007E-14) actually resutl is 0 (Zero) How can i solve this problem? Thanks. Başak Öner
-
Hi everybody, I have some numbers. Numbers are ( 0 234,9 -27 0 -55,9 0 0 -59 0 100,72 -26 0 -25,72 0 0 0 -82 0 0 0 0 0 0 -134) I want to this. SELECT SUM(FIELDX) FROM TBLX but result is returning (-2,8421709430404007E-14) actually resutl is 0 (Zero) How can i solve this problem? Thanks. Başak Öner
-
sorry I don't understand your message. I need your detailed explanation. Thanks.
-
sorry I don't understand your message. I need your detailed explanation. Thanks.
Basak Oner wrote:
sorry I don't understand your message.
Try the
ROUND
function. This is due to how computers work and how they calculate. You know what a fractional number is, but they do not exist within a computer.Basak Oner wrote:
I need your detailed explanation.
You're not in school anymore. There's an explanation here[^], good luck.
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
-
Hi everybody, I have some numbers. Numbers are ( 0 234,9 -27 0 -55,9 0 0 -59 0 100,72 -26 0 -25,72 0 0 0 -82 0 0 0 0 0 0 -134) I want to this. SELECT SUM(FIELDX) FROM TBLX but result is returning (-2,8421709430404007E-14) actually resutl is 0 (Zero) How can i solve this problem? Thanks. Başak Öner
You can try to change the datatype of the field. Check if
SELECT SUM(cast(FIELDX as numeric(5,2)) FROM TBLX
works. In your real data you naturally need to adjust the precision and scale of the numeric field to fitting values.Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
Basak Oner wrote:
sorry I don't understand your message.
Try the
ROUND
function. This is due to how computers work and how they calculate. You know what a fractional number is, but they do not exist within a computer.Basak Oner wrote:
I need your detailed explanation.
You're not in school anymore. There's an explanation here[^], good luck.
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
Thanks for your free time.
-
Thanks for your free time.