I have this column Break
in integer format.
The values are:
- 100 = 1h
- 130 = 1h and 30 minutes
I need to extract the minutes from this column:
- 100 = 1h = 60 minutes
- 130 = 1h and 30m = 90 minutes
I tried with this SQL, but it doesn't work:
select
convert(int, datediff(minute, 0, convert(varchar(8), dateadd(minute, TSH1."Break", ''), 114) ))
from TSH1
Can anyone help me?
Thanks
CodePudding user response:
The following code will produce the output you want
select
(((CAST(TSH1."Break" AS INT) / 100) * 60) (CAST(TSH1."Break" AS INT) % 100)) As col
from TSH1