Subject | Re: [firebird-support] sum and time fields |
---|---|
Author | Helen Borrie |
Post date | 2006-05-28T23:22:54Z |
At 02:05 AM 29/05/2006, you wrote:
which won't be anything useful as data.
A TIME type is not a duration or 'interval of time'.
It is a date/time type, representing the time of day. For example,
if you see the value '20:25:15.0000', it is storing the time '8:25:15
PM'. In the database the same value is a DECIMAL(9,4) representing
'number of seconds since midnight on the day that the value was
stored', i.e. 73515.0000 (actually, 735150000 with a scale of
4). You cannot access the value in this form.
what we are telling you....
./heLen
>Thanks Helen and thanks Alan for your answers,It's wrong.
>
>Helen suggested :
>
> > select phone_number, sum(end_time - start_time) as Total_duration
> > from phone_calls
> > group by phone_number
> > where ...
>
>Perhaps something like :
>
>select phone_number, sum(duration - cast('00:00:00' as time)) as
>total_duration
>from phone_calls
>group by phone_number
>where ...
>
>What do you think of this ?
>It seems it is correct for Firebird 1.5 (I mean there is no errorAssuming 'duration' is a TIME type, it will be a DECIMAL(9,4) value
>message and the result is what I expect) but I'm not sure what the type
>of the result is.
which won't be anything useful as data.
>When I execute the SQL script with IBConsole whichYou still haven't got the point.
>comes with Delphi, it works fine, but when I try to get the field
>total_duration value in a FreePascal Integer variable, FreePascal talks
>about a conversion error.
A TIME type is not a duration or 'interval of time'.
It is a date/time type, representing the time of day. For example,
if you see the value '20:25:15.0000', it is storing the time '8:25:15
PM'. In the database the same value is a DECIMAL(9,4) representing
'number of seconds since midnight on the day that the value was
stored', i.e. 73515.0000 (actually, 735150000 with a scale of
4). You cannot access the value in this form.
>Thanks again for your precious help.It our help is so precious, why do you continue to refuse to believe
what we are telling you....
./heLen