请帮助我。我需要减去LogIn Time和LogOut Time。我只需要几小时作为答案。这是什么My Sql语法?提前谢谢。
答案 0 :(得分:1)
你可能想要timediff
的组合http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timediff
mysql> SELECT TIMEDIFF('2008-12-31 23:59:59.000001',
-> '2008-12-30 01:01:01.000002');
-> '46:58:57.999999'
和小时
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_hour
mysql> SELECT HOUR('10:05:03');
-> 10
答案 1 :(得分:0)
尝试
SELECT DATEDIFF(HOUR,start,end)
http://msdn.microsoft.com/en-us/library/ms189794%28v=sql.90%29.aspx 希望这有帮助