SQL Need Help! (round($VAR, 1))

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MichaelP
    Registered User
    • Aug 2003
    • 7124

    #1

    SQL Need Help! (round($VAR, 1))

    Ok I,m working on something and I'm a bit puzzled here

    with ROUND : (round($VAR, 1))

    I try to round Var numbers at the closest .5 with only one decimal

    Now I can have :

    $var = 1.01 gives 1
    $var = 1.23 gives 1.3
    $var = 1.42 gives 1.4
    $var = 1.77 gives 1.8

    What I'd like :

    $var = 1.01 gives 1
    $var = 1.23 gives 1
    $var = 1.42 gives 1.5
    $var = 1.77 gives 2

    Well, you get the idea... So in a nutshell, I'd like my result to be at the closest .5

    I also tried Ceil and Floor

    Is it something possible ?

    Txs Forward
    Last edited by MichaelP; 03-15-2008, 12:00 PM.
Working...