473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Using Round in a sql query

I have the following two cases in my sql query I would like to round the results (round 0) however I cannot figure out the correct syntax to use round in this instance.. any help on this would be greatly appreciated

Expand|Select|Wrap|Line Numbers
  1. CASE WHEN tbl_CCMonitorSheetAnswer.Answer = 'False' THEN (tbl_CCMonitorFormQuestion.Points - tbl_CCMonitorFormQuestion.Points) 
  2.                       WHEN tbl_CCMonitorSheetAnswer.Answer IS NULL THEN NULL ELSE tbl_CCMonitorFormQuestion.Points END AS [Achieved Points], 
  3.  
  4.                       CASE WHEN tbl_CCMonitorSheetAnswer.Answer IS NULL THEN NULL ELSE tbl_CCMonitorFormQuestion.Points END AS [Max Points],
May 19 '08 #1
5 2561
ck9663
2,878 Expert 2GB
Round(0) ?

Do you want to remove the decimal place?

Here's the full ROUND syntax.

-- CK
May 19 '08 #2
Yes that is correct (I want to remove the decimal place).. and i have read over that but I cannot figure out how to use round in conjunction with the case syntax (my example above) how would i incorporate round into that select?
May 19 '08 #3
I can do it on the reporting end and use Round(Fields!Achieved_Points.Value) but it then rounds all Null Values to 0 and null values need to remain Null
May 19 '08 #4
Also if i modify my query like the following.. it only rounds to the nearest whole number but leaves the decimal place

Expand|Select|Wrap|Line Numbers
  1. CASE WHEN tbl_CCMonitorSheetAnswer.Answer = 'False' THEN Round(tbl_CCMonitorFormQuestion.Points - tbl_CCMonitorFormQuestion.Points, 0) 
  2. WHEN tbl_CCMonitorSheetAnswer.Answer IS NULL THEN NULL ELSE Round(tbl_CCMonitorFormQuestion.Points, 0) END AS [Achieved Points], 
  3. CASE WHEN tbl_CCMonitorSheetAnswer.Answer IS NULL THEN NULL ELSE round(tbl_CCMonitorFormQuestion.Points, 0) END AS [Max Points], 
May 19 '08 #5
ck9663
2,878 Expert 2GB
I can do it on the reporting end and use Round(Fields!Achieved_Points.Value) but it then rounds all Null Values to 0 and null values need to remain Null
Then a CASE function would do

Expand|Select|Wrap|Line Numbers
  1. Value = case when Fields!Achieved_Points.Value is null then null else Round(Fields!Achieved_Points.Value) end
-- CK
May 20 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: steve | last post by:
Hi, I'd like to round all amounts in a certain column to 2 decimals. I tried the following query, but eventhough the syntax is correct, it doesn't give any result: update gbkmut set bdr_hfl...
5
by: Peter Scheurer | last post by:
Hi, we found some strange behavior when operating with floats and round(). The following simplified statement reproduces the problem. select 6.56 - round(convert(float, 6.56), 2) from...
6
by: dkintheuk | last post by:
Hi all, I have a form with some unbound combo's and a list box that are used to requery the dataset behind the form. All was working fine until i added the list box. I have the record set...
3
by: Jeff | last post by:
using access db and asp i have a variable from a form sRound = request.form("round") and for now let us say this value is 3 now i want to include that 3 in sql, but it is part of a field name...
2
by: roz | last post by:
Hello, I'm fairly new to VB programming and I've been going round the bend with this problem, so any nudges or shoves in the right direction would be greatly appreciated. I have a template...
3
by: Bob Alston | last post by:
I have recently been trying to determine the best technique to pull the least amount of info across the LAN link in a slow speed LAN situation (e.g. < 10 Mbps), where data volume = performance. ...
10
by: Henrootje | last post by:
I am looking for a way to round down the results of a calculation in a query f.e.: in a query this calculation is performed: a/b = c 5/3 = 1,666666667
0
by: tangoal | last post by:
I have a table1 as: id(int); percent(double,2); a(double,2); b(double,2); c(double,2);.....z(double,2) 1; 0.12; 1.33; 1.26; 1.89;........ 2; 0.11; 1.55; 1.22; 1.56;........ : : and many...
2
by: deanoooo812 | last post by:
I have an Access query (written in MS Access 2000 - thats all we've got - don't get me started on that topic...) for making pharmacy dispensing labels based on an extract from an automated dispensing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.