Search code examples
sqlsql-servert-sqldatediff

using DateDiff to find duration in minutes


I am trying to use Datediff to find out the duration between columnA and 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?


Solution

  • how about trying this, not sure why you have stime = [exceptions2].starttime and etime = [exceptions2].endtime

    SELECT datediff(minute, starttime, endtime) from Exceptions2