I have the time value in one column like below.
Now I need to sum this column and convert the result to minutes.
Asked
Active
Viewed 762 times
0

Vadim Kotov
- 8,084
- 8
- 48
- 62

karthisena
- 19
- 7
2 Answers
1
You can convert the time to seconds and then divide by 60 to get minutes. Something like:
SELECT SUM(TIME_TO_SEC(`activeTime`))/60 FROM tableName
That will give you the decimal version of the minutes (e.g. 5.8 minutes = 5 minutes and 48 seconds). If you want the minutes in time notation (e.g. 05:48):
SELECT SEC_TO_TIME( SUM(TIME_TO_SEC(`activeTime`)) ) FROM tableName

TheGentleman
- 2,324
- 13
- 17
0
This can help you:
Convert time into seconds,in your case column name is activeTime:
SELECT TIME_TO_SEC('00:12:0');
SELECT TIME_TO_SEC(your_column);
Perform sum operation:
SELECT SUM(output_of_TIME_TO_SEC) AS "total second" FROM table_name;

Vadim Kotov
- 8,084
- 8
- 48
- 62

mayur
- 25
- 8