0 votes
1 view
in SQL by (20.3k points)

I need to convert minutes to hours, rounded off to 2 decimal places. I also need to display only up to 2 numbers after the decimal point. So if I have minutes as 650. Then hours should be 10.83

Here's what I have so far:

Select round(Minutes/60.0,2) from ....

But in this case, if my minutes are, say,630 - hours is 10.5000000. But I want it as 10.50 only(after rounding). How do I achieve this?

1 Answer

0 votes
by (40.4k points)

 If x <= 38, then do not cast the result as numeric(x,2)..

Try the code given below:



cast(round(630/60.0,2) as numeric(36,2))


10.500000   10.50

Related questions

0 votes
1 answer
0 votes
1 answer
asked Oct 17, 2019 in Java by Anvi (10.2k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !