>Hi
> I have a table with 2 fields one is a name, the other is a character type that contains something like this 00:02'23 which mean that this person talked on the phone for 2 minutes and 23 seconds, now I want to know is a sum of how long every person talked on the phone can anybody help
Create a function to convert to decimal hours, then use it in a SELECT - SQL to get the totals:
FUNCTION StringTimeToDecimalHours
LPARAMETERS ;
tcStringTime
RETURN (3600 * VAL(SUBSTR(tcStringTime, 1, 2)) + ;
60 * VAL(SUBSTR(tcStringTime, 4, 2)) + ;
VAL(SUBSTR(tcStringTime, 7, 2))) / 3600
SELECT ;
cPersonName, ;
SUM(StringTimeToDecimalHours(cStringTimeField)) AS nHours ;
FROM MyTable ;
INTO CURSOR Results ;
GROUP BY cPersonName
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up