Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Roundup or down to nearest cent (2 decimal places)

Status
Not open for further replies.

ajaeger

Technical User
Feb 6, 2003
201
US
I see that there is a way to round up or down to the nearest integer (ceiling or floor), but is there a way to round up or down to the nearest cent (.##). In Excel you can use the roundup or rounddown functions, but I've been having trouble finding something like that in SQL. Thanks!

Anna Jaeger
iMIS Database Support
 


Dear ;

You can use Round() funtion and it will do round up , for example

select Round(123.147,2)

it will give you 123.150 !

Is it your solution or somethingelse.

there is a way to use Floor function as well to get do decimal answer !

Select Floor(123.147*100)/100 and you can use it for round down.

Please , let me know is it your solution.

Essa

Muhammad Essa Mughal
Software Engineer
essamughal@yahoo.com
 
Great! The floor/ceiling *100 is PERFECT. I knew about the round() function, but need some values to always round up or down (even if 12.001, I want 12.01 not 12.00).

Anna

Anna Jaeger
iMIS Database Support
 
Good ! You know what ! If you want to have 3 decimal place then multiply it by 1000 and divide it by 1000 !

But , how can you find your answer using this solution(even if 12.001, I want 12.01 not 12.00). it is somehow different thing and it makes different scence as well.



Thanks.
Essa

Muhammad Essa Mughal
Software Engineer
essamughal@yahoo.com
 
Essa, on paper it seems to work :) But when I created a query (simplified a bit):

SELECT Member.ID, Floor(NATL_DUES) as FLOOR_DUES
FROM Member

I get "Undefined function 'floor' in expression"

Any thoughts? Thanks!



Anna Jaeger
iMIS Database Support
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top