|
Joe, You have hit the nail on the head. The following is much better. SELECT integer((decimal(sum(NumVal),11,2) + .5)) FROM File INTEGER or INT truncates. Thanks, David Morris >>> Joe Giusto <JGiusto@patuxent.com> 01/05 3:04 PM >>> How about adding .5 to your result and then convert to integer. Like INTEGER = DECIMAL# + .5 Does the integer function truncate or round? I am not sure about the divide by .5 in the example below. Joe Giusto II Patuxent Publishing Company <mailto:jgiusto@patuxent.com> mailto:JGiusto@patuxent.com http://www.lifegoeson.com <http://lifegoeson.com> ----Original Message----- From: David Morris [SMTP:dmorris@plumcreek.com] Sent: Monday, January 04, 1999 11:03 AM To: MIDRANGE-L@midrange.com Subject: Re: Round Off function in SQL Prakash, I asked the same question in August, no response. The best I could come up with was the following: SELECT integer(((decimal(sum(NumVal),11,2) - integer(sum(NumVal))) / .5)) + integer(sum(NumVal)) FROM File In our case it was acceptable but I would like to find a better solution. David Morris +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.