calculate a sum of type time using sql

前端 未结 4 787
孤城傲影
孤城傲影 2020-11-27 06:34

How to caculate sum of times of my colonne called \"timeSpent\" having this format: HH:mm in SQL? I am using MySQL.

the type of my column is Time.

it has th

4条回答
  •  旧时难觅i
    2020-11-27 06:57

    SELECT  SEC_TO_TIME( SUM( TIME_TO_SEC( `timeSpent` ) ) ) AS timeSum  
    FROM YourTableName  
    

    This worked for me. Hope this helps.

提交回复
热议问题