如果时差结果为负,我该如何设置为零
select TIMEDIFF('2016-01-29 12:28:18','2016-01-29 19:27:51') as diff;
| -06:59:33 |
答案 0 :(得分:0)
试试这个:
select if((time_to_sec(TIMEDIFF('2016-01-29 12:28:18','2016-01-29 19:27:51'))/3600) < 0,0,TIMEDIFF('2016-01-29 12:28:18','2016-01-29 19:27:51')) as diff;