calculate a sum of type time using sql

前端 未结 4 781
孤城傲影
孤城傲影 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条回答
  •  抹茶落季
    2020-11-27 07:11

    100% working code to get sum of time out of MYSQL Database:

    SELECT
    SEC_TO_TIME( SUM(time_to_sec(`db`.`tablename`))) 
    As timeSum
    FROM
    `tablename`
    

    Try and confirm. Thanks.

提交回复
热议问题