Results 1 to 5 of 5

Thread: SQL How to..??

  1. #1
    Join Date
    May 2003
    Location
    Pinoy in NJ
    Posts
    104

    Question Unanswered: SQL How to..??

    How can I query to show only up to 2 decimal places? Thanks.

    Code:
    select round(vruservicemin/60,2) from workorder where vruservicemin>0
    RESULTS
    ------------------------
    .580000
    .020000
    .020000
    .020000
    .020000
    .020000

  2. #2
    Join Date
    Jun 2003
    Posts
    2
    select left(round(vruservicemin/60,2), 4) from workorder where vruservicemin>0

  3. #3
    Join Date
    May 2003
    Location
    Pinoy in NJ
    Posts
    104

    Thumbs up

    Thanks it did the trick.

    However, how do I handle if the results vary? I tried using
    LEFT(value,len(value)-4) but it didn't work.


    RESULTS:
    _____________
    0.16667
    10.16667
    110.16667




    Last edited by ARPRINCE; 06-28-03 at 14:28.

  4. #4
    Join Date
    Jun 2003
    Location
    Singapore
    Posts
    4
    I experience this situation many times, what I do is using Cast() to convert the value returned to a fixed decimal place.

    Your original coding will look like this:

    select cast(round(vruservicemin/60,2) as decimal(8,2)) from workorder where vruservicemin>0

    You may decide to use decimal 8,2 or 10,2, or any size depending on the needs.

    Best Regards.

  5. #5
    Join Date
    May 2003
    Location
    Pinoy in NJ
    Posts
    104

    Thumbs up

    Thank you again. It was perfect!

Posting Permissions

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