Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Easy Rounding Question

Author  Topic 

rme8494
Yak Posting Veteran

98 Posts

Posted - 2005-04-05 : 15:16:55
The query below returns a value of 4 and I would like to get a value of 5.

COUNT(Entry_ID) = 277
COUNT(Entry_ID) / 60 = 4.6

SELECT ROUND((COUNT(Entry_ID)/60),0) AS PageCount
FROM eSRS_BilLData
WHERE Request_ID = 1

Can someone help me here? I thought Round would work. I need anything over 4.0 to be displaed as 5 pages.

Ryan




Ryan Everhart
SBC

SBC. Going Beyond the Call!

rfrancisco
Yak Posting Veteran

95 Posts

Posted - 2005-04-05 : 15:30:40
You should be using the ceiling function and not round. Your query will look like this:

SELECT CEILING(COUNT(Entry_ID)/60.0) AS PageCount
FROM eSRS_BilLData
WHERE Request_ID = 1

Take note, I changed the 60 to 60.0 to make it decimal and not int.
Go to Top of Page

rme8494
Yak Posting Veteran

98 Posts

Posted - 2005-04-05 : 15:41:28
That worked!!! Thank you very much! I tried ceiling but the 60.0 was the key!

Ryan

Ryan Everhart
SBC

SBC. Going Beyond the Call!
Go to Top of Page
   

- Advertisement -