From derby-user-return-7216-apmail-db-derby-user-archive=db.apache.org@db.apache.org Tue Jul 17 10:11:33 2007 Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 82054 invoked from network); 17 Jul 2007 09:53:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jul 2007 09:53:08 -0000 Received: (qmail 35775 invoked by uid 500); 17 Jul 2007 08:03:06 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 35751 invoked by uid 500); 17 Jul 2007 08:03:05 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 35740 invoked by uid 99); 17 Jul 2007 08:03:05 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jul 2007 01:03:05 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of peter.ondruska@gmail.com designates 66.249.92.173 as permitted sender) Received: from [66.249.92.173] (HELO ug-out-1314.google.com) (66.249.92.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jul 2007 01:03:02 -0700 Received: by ug-out-1314.google.com with SMTP id a2so100842ugf for ; Tue, 17 Jul 2007 01:02:41 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:subject:date:to:x-mailer:from; b=l3wGm8K08wVKK4WReEdmDNqfpFzyccmesPyttlcqgwoSmOe/dDjddvC4a7LR2QTtTNcFBClsDLXL5t/Ob1mVAoa2DNGscCndNF3Us57L7ozRx2vRAlSHW5gykOVL1wVllOmW+70yIuGUgB4D/bxA+j0VoU+9v4VUSNjaK8B5/hI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:subject:date:to:x-mailer:from; b=mF2Y3zX0j+KsHg1XxuhSn4WJujd0BeCt3KNk0eIicseuwgEUR2Cm6HIPRetFeRzWG+dUQ3f9Av4UCj3K9j0PHL+SfksW2q8bzHDXuvdulmI/tUoeOAAYmWxtDwlwvfZGRCNPpORBzqEN4y9g3ONspeT5pX1srjIp4xTfylWDZ6k= Received: by 10.67.20.11 with SMTP id x11mr161403ugi.1184659360963; Tue, 17 Jul 2007 01:02:40 -0700 (PDT) Received: from ?192.168.123.50? ( [62.168.42.102]) by mx.google.com with ESMTPS id l40sm1802515ugc.2007.07.17.01.02.39 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jul 2007 01:02:40 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <575A21CC-25C3-4AA4-979C-2F7C44A0C3D4@gmail.com> Content-Transfer-Encoding: 7bit Subject: Re: Sum of time Date: Tue, 17 Jul 2007 10:02:37 +0200 To: "Derby Discussion" X-Mailer: Apple Mail (2.752.3) From: Peter Ondruska X-Virus-Checked: Checked by ClamAV on apache.org 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/