Help with Math in SELECT stmt

  • I am sure what I am doing wrong is very simple, I just cant seem to figure this out. Why does this:

    SELECT 2670*(1-(30/100))

    NOT equal this: 1869 (which is the result if you enter the above math problem in your calculator)

    Any and All help will be greatly appreciated.

  • Because you're dividing two integers and not two decimals.

    30/100 = 0

    30/100. = .3

    SELECT 30/100, 30/100.

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • Thanks for the reply, I ended up getting it with this:

    SELECT (2670*(1-(convert(decimal(18,2),30)/100)))

    Thanks Again.

  • Although adding a simple "." does the same. 🙂

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply