Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009
    Posts
    21

    Unanswered: select a rounded float field

    Hi

    i am creating a price searching widget.

    the price table has the fields
    price , product_id


    Sometimes the price is a long float for example 4,56889
    I d like to return also this product_id when the user searches for 4,57.

    so i need a where clause in which i can round the db price field.

    I used "WHERE ROUND(price,2) =4,57" but it does not rounding the price.

    Is there a way to do that ?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Code:
    select my, column, list, ROUND(price,2) as RPrice from MyTable
    where round(Price,2)  = 4.57;
    seems to work for me
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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