0
如何計算存儲在MySQL列中的時間總和? 表名:時間表如何獲得mysql的時間總和?
+----------+
| hours |
+----------+
| 02:00:00 |
| 03:30:00 |
| 04:30:00 |
| 05:30:00 |
| 06:00:00 |
| 07:00:00 |
| 08:00:00 |
| 09:00:00 |
+----------+
我需要輸出:45:30:00
。 我試着用下面的SQL
select sum(hours) from timesheet ;
卻是露出449000
能否請您通過適當的SQL指正?
請檢查這個問題,這可能是幫助你[Sackoverflow問題(http://stackoverflow.com/questions/3054123/calculate-a-sum-of -type-time-using-sql) – Apoorva
'select SEC_TO_TIME(sum(TIME_TO_SEC(hours)))from timeheet;' – Damith
Yah !!它正在工作。非常感謝你@Damith。 – Mihir