Sql 使用DateDiff查找以分钟为单位的持续时间
我试图使用Sql 使用DateDiff查找以分钟为单位的持续时间,sql,sql-server,tsql,datediff,Sql,Sql Server,Tsql,Datediff,我试图使用Datediff找出columnA和columnB之间的持续时间 SELECT datediff (minute, stime, etime) from Exceptions2 where stime = [exceptions2].starttime and etime = [exceptions2].endtime 这会产生错误。有人能帮我解决我做错了什么吗?试试看,不知道为什么会有stime=[exceptions 2]。starttime和etime=[exceptions
Datediff
找出columnA
和columnB
之间的持续时间
SELECT datediff (minute, stime, etime)
from Exceptions2
where stime = [exceptions2].starttime
and etime = [exceptions2].endtime
这会产生错误。有人能帮我解决我做错了什么吗?试试看,不知道为什么会有stime=[exceptions 2]。starttime和etime=[exceptions 2]。endtime
SELECT datediff(minute, starttime, endtime) from Exceptions2
使用
WHERE
子句筛选结果。不幸的是,它不是用来创建别名的。:)如果Raymund的答案是你所寻求的,考虑给他信用,通过标记他作为公认的答案。没有必要仅仅为了评论而发布另一个答案。:)