我的SQL如下:
select right(oph.create_time,8) - '09:00:00' from xxxxx,
oph.create_time 为数据库中的某个时间 例如: 数据为 2016-07-07 19:24:30
但是减出来的数据是小时,并且小于一小时的都记为0了,我需要的是分钟数,请问一下具体怎么操作?
可以用这个
(datepart(hour,oph.create_time)-9)*60+datepart(minute,oph.create_time)
代替你上面红框中的部分,可以得到分钟