Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Location
    Egypt
    Posts
    7

    Exclamation Unanswered: Wrong result in query statement how to fix?!!

    The query is (Select (25/20*100))
    The wrong giving result is 100 it's should be 125
    How I can use a query statement to get a correct result?

  2. #2
    Join Date
    May 2004
    Posts
    125
    select convert(float, 25)/convert(float, 20) * 100

    or

    select 25.0/20.0*100

    You are getting wrong value because it is doing a int/int which rounds off to 1(select 25/20). Using the .0 or the convert funtion puts it into a float which will give you 1.25.

    HTH
    DMW

  3. #3
    Join Date
    Mar 2004
    Location
    Toronto
    Posts
    28
    SELECT 25.0/20.0*100.0

    Supply the .0's will force it to do real number math.

  4. #4
    Join Date
    Mar 2004
    Location
    Toronto
    Posts
    28
    SELECT 25.0/20.0*100.0

    Supplying the .0's will force it to do real number math.

  5. #5
    Join Date
    Sep 2003
    Location
    Egypt
    Posts
    7
    thank you very much...My Name Is Mohamed Ashour
    ashour_mohamed@hotmail.com
    Nice to meet you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •