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. Other Discussions
  3. The Weird and The Wonderful
  4. sql maths

sql maths

Scheduled Pinned Locked Moved The Weird and The Wonderful
databasesql-serversysadminhelp
5 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.
  • K Offline
    K Offline
    kmoorevs
    wrote on last edited by
    #1

    I chased this sql server error for weeks. This a query for getting received items total value. For brevity, the fields are: q (int) = unit quantity us (int) = units per sleeve (never null or 0) sc (int) = sleeves per case (never null or 0) cv (money) = case value The basic query provided to me from the vendor looked like this:

    Sum((q / (us*sc)) * cv) as totalValue

    The query ran just fine, but we were always short... :laugh: It turns out the original query was only ever tested with full case counts. :omg: btw, it's fixed, but just thought someone might get a chuckle out of it! :)

    "Go forth into the source" - Neal Morse

    R T 2 Replies Last reply
    0
    • K kmoorevs

      I chased this sql server error for weeks. This a query for getting received items total value. For brevity, the fields are: q (int) = unit quantity us (int) = units per sleeve (never null or 0) sc (int) = sleeves per case (never null or 0) cv (money) = case value The basic query provided to me from the vendor looked like this:

      Sum((q / (us*sc)) * cv) as totalValue

      The query ran just fine, but we were always short... :laugh: It turns out the original query was only ever tested with full case counts. :omg: btw, it's fixed, but just thought someone might get a chuckle out of it! :)

      "Go forth into the source" - Neal Morse

      R Offline
      R Offline
      RedDk
      wrote on last edited by
      #2

      Without showing code there's little interesting here (especially since "nothing" was fixed :laugh: ) ... There's 'yer chuckle though.

      kmoorevs wrote:

      fixed

      That's like some sort of like quantum foam, right? if i'm not mistaken

      K 1 Reply Last reply
      0
      • R RedDk

        Without showing code there's little interesting here (especially since "nothing" was fixed :laugh: ) ... There's 'yer chuckle though.

        kmoorevs wrote:

        fixed

        That's like some sort of like quantum foam, right? if i'm not mistaken

        K Offline
        K Offline
        kmoorevs
        wrote on last edited by
        #3

        :thumbsup: for the pun. :laugh:

        "Go forth into the source" - Neal Morse

        1 Reply Last reply
        0
        • K kmoorevs

          I chased this sql server error for weeks. This a query for getting received items total value. For brevity, the fields are: q (int) = unit quantity us (int) = units per sleeve (never null or 0) sc (int) = sleeves per case (never null or 0) cv (money) = case value The basic query provided to me from the vendor looked like this:

          Sum((q / (us*sc)) * cv) as totalValue

          The query ran just fine, but we were always short... :laugh: It turns out the original query was only ever tested with full case counts. :omg: btw, it's fixed, but just thought someone might get a chuckle out of it! :)

          "Go forth into the source" - Neal Morse

          T Offline
          T Offline
          Tomz_KV
          wrote on last edited by
          #4

          Is decimal portion not required?

          TOMZ_KV

          K 1 Reply Last reply
          0
          • T Tomz_KV

            Is decimal portion not required?

            TOMZ_KV

            K Offline
            K Offline
            kmoorevs
            wrote on last edited by
            #5

            Tomz_KV wrote:

            Is decimal portion not required?

            Yes, which was the problem...division casts to the datatype with highest precision for parameters in the equation. (I'm probably saying that wrong!) The correction was to convert one of the parameters in the division to a decimal. :laugh: I only posted here 'cause we no longer have a 'hall of shame'!

            "Go forth into the source" - Neal Morse

            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