Reputation: 481
I am using this SQL Query:
SELECT ROUND((hours*60+minutes)/30) from table
which calculates the number 30 minutes segments
if i have 2 hours, 10 minutes this is returning 30_minute_segments = '4'
however i would like it to show 5 as the 10 minutes
should count as 30 minutes.
how can i do this?
Upvotes: 0
Views: 3713
Reputation: 11613
I think you want to use CEIL
instead of ROUND
. CEIL
will round up.
SELECT CEIL((hours*60+minutes)/30) from table
I just realized that I assumed you were using Oracle. But you didn't specify your database.
For SQL Server, the equivalent function is CEILING()
. Most databases have something similar. (Note: if using SQL Server, be mindful of @Chizzle's comment below.)
Upvotes: 5