using DateDiff to find duration in minutes

Doug Ancil picture Doug Ancil · Nov 1, 2010 · Viewed 85k times · Source

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?

Answer

Raymund picture Raymund · Nov 1, 2010

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

SELECT datediff(minute, starttime, endtime) from Exceptions2