I have data in a table listed as
44:22:22
333:33:33
It stands for hhh:mm:ss
I want to break each part of the data into different parts based on the ':' to separate
them. Then I want to take that data and sum it. I wrote an if statement to parse through
this table but I can't get it to work. I am not sure If my syntax is
wrong because I can't find anything to check against it.
Here is the syntax:
IF
(SELECT job_walltime
FROM time
WHERE CHAR_LENGTH( job_walltime ) >=9)
THEN
(SELECT sum( left( job_walltime, '3' ) ) hours, sum(mid( `job_walltime` , 4, 2 )) ,
sum( right( job_walltime, '2' ) ) seconds
FROM `time`)
ELSE
(SELECT sum( left( job_walltime, '3' ) ) hours, sum(mid( `job_walltime` , 3, 2 ) ),
sum( right( job_walltime, '2' ) ) seconds
FROM `time`)
END
I know this isn't the only way to do this but this but this is the first suggestion that
comes to mind. Any input would be great.
Further info MySQL 3.23.58 running on RedHat 9
-Chris Vaughan
www.clusters.umaine.edu

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.