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?
The DATEDIFF() function returns the difference between two dates.
MySQL TIMEDIFF() Function The TIMEDIFF() function returns the difference between two time/datetime expressions. Note: time1 and time2 should be in the same format, and the calculation is time1 - time2.
To calculate the number of days between date1 and date2, you can use either Day of year ("y") or Day ("d"). When interval is Weekday ("w"), DateDiff returns the number of weeks between the two dates. If date1 falls on a Monday, DateDiff counts the number of Mondays until date2. It counts date2 but not date1.
DATEDIFF returns the total number of the specified unit between startDate and endDate.
how about trying this, not sure why you have stime = [exceptions2].starttime and etime = [exceptions2].endtime
SELECT datediff(minute, starttime, endtime) from Exceptions2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With