Time difference returning integer ansi sql 92
问题 I am trying to calculate the number of minutes between two datetimes using sql ansi-92 . I'm not able to use timestampdiff() function because I get an error response. I tried date1 - date2 , but I always get a result of 0 (although no error). Example: select '2016-11-02 15:25:00' - '2016-11-02 15:05:00' 回答1: That certainly should work for you: select TIMESTAMPDIFF(MINUTE,a.my_date2,a.my_date) diff, TIMESTAMPDIFF(MINUTE,'2016-11-02 15:05:00','2016-11-02 15:25:00') diff2 from my_tab a I got the