Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SUM Problem in MSSQL

SUM Problem in MSSQL

Scheduled Pinned Locked Moved Database
questionsql-serverhelp
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Basak Oner
    wrote on last edited by
    #1

    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

    L J 2 Replies Last reply
    0
    • B Basak Oner

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Basak Oner wrote:

      actually resutl is 0 (Zero)

      Not if you're a computer, then it's "almost 0". Try rounding the result.

      Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

      B 1 Reply Last reply
      0
      • L Lost User

        Basak Oner wrote:

        actually resutl is 0 (Zero)

        Not if you're a computer, then it's "almost 0". Try rounding the result.

        Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

        B Offline
        B Offline
        Basak Oner
        wrote on last edited by
        #3

        sorry I don't understand your message. I need your detailed explanation. Thanks.

        L 1 Reply Last reply
        0
        • B Basak Oner

          sorry I don't understand your message. I need your detailed explanation. Thanks.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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[^]

          B 1 Reply Last reply
          0
          • B Basak Oner

            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

            J Offline
            J Offline
            Jorgen Andersson
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • L Lost User

              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[^]

              B Offline
              B Offline
              Basak Oner
              wrote on last edited by
              #6

              Thanks for your free time.

              L 1 Reply Last reply
              0
              • B Basak Oner

                Thanks for your free time.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                You actually *read* it? Ehr.. you're welcome, and yes, well done :)

                Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups