15,743,429 members
See more:
I Have a table and i want to update all the rows of Duration Column which is in Decimal format to HH:MM Format.

 ECode Duration 101 101.75 101 69.56 102 54.97 104 35.32

the out put should be like this:-

 ECode Duration 101 102.15 101 69.56 102 55.37 104 35.32

We are calculating the time after the decimal and if after decimal 60 or more then 60 will be there we are adding 1 before decimal and remaining after subtraction from 60 we are showing as it is.Example 101.75 , here after decimal 75 is there so firstly we check it is gtreater then and equal to 60 .if yes then subtract 60 and add 1 before decimal and put the remaining 15 after decimal.so the result become 102.15.
Please share the query if possible so that i will update all rows of the table and get the desired result.
Posted
Updated 29-Feb-12 22:49pm
v2
The Doer 1-Mar-12 4:02am
how your duration changes from 101.75 to 102.15???????/
Dharmenrda Kumar Singh 1-Mar-12 4:49am
We are calculating the time after the decimal and if after decimal 60 or more then 60 will be there we are adding 1 before decimal and remaining after subtraction from 60 we are showing as it is.Example 101.75 , here after decimal 75 is there so firstly we check it is gtreater then and equal to 60 .if yes then subtract 60 and add 1 before decimal and put the remaining 15 after decimal.so the result become 102.15.
Dharmenrda Kumar Singh 1-Mar-12 4:25am
After the Decimal we have .75 so .60=1 Min and thats why 101.75 will become 102.15.
Nilesh Patil Kolhapur 1-Mar-12 5:00am
use trigger before insert

## Solution 2

SQL
`update Table set duration = duration + 0.4 where duration - floor(duration) >= 0.6`

This Query had solved my problem.