SQL 使用 DateDiff 以分钟为单位查找持续时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4073340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
using DateDiff to find duration in minutes
提问by Doug Ancil
I am trying to use Datediff
to find out the duration between columnA
and columnB
.
我试图用来Datediff
找出columnA
和之间的持续时间columnB
。
SELECT datediff (minute, stime, etime)
from Exceptions2
where stime = [exceptions2].starttime
and etime = [exceptions2].endtime
This produces errors. Can anyone please help me with what I'm doing wrong?
这会产生错误。任何人都可以帮助我解决我做错了什么吗?
回答by Raymund
how about trying this, not sure why you have stime = [exceptions2].starttime and etime = [exceptions2].endtime
试试这个怎么样,不知道为什么你有 stime = [exceptions2].starttime 和 etime = [exceptions2].endtime
SELECT datediff(minute, starttime, endtime) from Exceptions2