db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Ondruska <peter.ondru...@gmail.com>
Subject Re: Sum of time
Date Tue, 17 Jul 2007 08:02:37 GMT
Well, first of all:

what do you expect as a value for (Date)A + (Date)B ?

What you want is an interval (perhaps in seconds) instead of time as  
duration.

p.

On 17.7.2007, at 9:57, Dmitri Pissarenko wrote:

> Hello!
>
> I have a table with with time fields. That is, each record has
>
> a) field "place" (string) and
> b) field "duration" (time).
>
> I want to run a query like this
>
> SELECT PLACE, SUM(DURATION)
> FROM MyTable
> GROUP BY PLACE
>
> But I'm getting following error message:
>
> SQL State = 42Y22 SQL Code = 30000 SQL Message = Aggregate SUM cannot
> operate on type TIME. Exception message =
> java.sql.SQLSyntaxErrorException: Aggregate SUM cannot operate on type
> TIME.
>
> How can I run this query (determine sum of duration per place)  
> nevertheless?
>
> TIA
>
> Dmitri Pissarenko
> -- 
> http://www.xing.com/profile/Dmitri_Pissarenko
> http://dapissarenko.blogspot.com/


Mime
View raw message