I am having to Cast()
a Text
datatype to a TIME
datatype. THe issue I'm running into is when the results display i'm loosing the hh:mm:ss
format. The syntax I am using is Select SUM(CAST(salestime As Time)) From testData;
How do I display my query results in hh:mm:ss
format? I also tried to use this syntax SUM(Cast(Time_Format(salesTime, "%h, %i, %s") As Time))
but that is returning a whole number
EDIT
A few sample of the times in the TEXT
column are:
0:05:58
0:00:00
0:31:54
0:23:26
Best Answer
You can use this
Schema (MySQL v8.0)
Query #1
View on DB Fiddle
But TIME can only have the maximum of 838:59:59, if your
SUM
get bigger, you need to convert the seconds also intodd.hh:mm:ss