Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 77405 invoked from network); 6 Mar 2006 18:26:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Mar 2006 18:26:27 -0000 Received: (qmail 7525 invoked by uid 500); 6 Mar 2006 18:27:06 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 7489 invoked by uid 500); 6 Mar 2006 18:27:06 -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 7478 invoked by uid 99); 6 Mar 2006 18:27:06 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Mar 2006 10:27:06 -0800 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [65.195.181.55] (HELO dbrack01.segel.com) (65.195.181.55) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Mar 2006 10:27:04 -0800 Received: from Desktop02 (desktop02.segel.com [65.195.181.45]) by dbrack01.segel.com (Postfix - We shoot spammers on site.) with ESMTP id 66F964A5D8 for ; Mon, 6 Mar 2006 12:29:13 -0600 (CST) Reply-To: From: Sender: "Michael Segel" To: "'Derby Discussion'" Subject: RE: Derby Function Date: Mon, 6 Mar 2006 12:26:37 -0600 Organization: MSCC MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <5F3EBBC316C84F49A35B29023D459932E9125F@SLNTEXG.quadrian.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcZAhXuOpTSxCwnoTJGsvSt02JsjvgAwDyeg Message-Id: <20060306182913.66F964A5D8@dbrack01.segel.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I don't believe this solves the original question. The issue isn't with the meta data, but the lack of a built in function to allow for different groupings. I think that this might solve the problem.... Select a,b,c... YEAR(x)foo, MONTH(x) bar, DAY(x) retz Then do a GROUP BY foo or bar or retz. This should work... in theory at least, assuming that there is a YEAR(), MONTH() and DAY() functions available. (If not, you can always write them... ;-) -Mike > -----Original Message----- > From: Alex Miller [mailto:amiller@metamatrix.com] > Sent: Sunday, March 05, 2006 12:51 PM > To: Max Ten; Stanley Bradbury; Derby Discussion > Subject: RE: Derby Function > > Hi Max, > > Another option would be to use the MetaMatrix Query product on top of > Derby. MetaMatrix Query is a federated SQL engine with a JDBC driver > that supports Oracle, SQL Server, Sybase, DB2, MySQL, PostgreSQL, Derby, > and others. Our tool allows you to import metadata from one or more of > these databases and use SQL to access one or many of them in a single > SQL statement. > > You can see our new developer web site at > http://devcentral.metamatrix.com and download a free trial of MetaMatrix > Query at http://devcentral.metamatrix.com/download/Home. We currently > support Derby only in network (client/server) mode as there are some > issues with classloaders and the single engine per VM constraints of > Derby. > > With respect to your particular need, MetaMatrix supports functions in > GROUP BY and can be used to enhance Derby with this functionality. > Unfortunately, there is an issue in our Derby connector that is > preventing this from working in MetaMatrix Query 5 EA1, which is the > current download. We will have EA2 out in a few days and that issue is > resolved. > > For more details on an example query just like yours (and how it works > in EA2), see my blog on the subject at > http://devcentral.metamatrix.com/blog/alex/2006/02/28/Enhancing-Apache-D > erby-with-MetaMatrix. > > Alex Miller > Chief Architect > MetaMatrix > > > -----Original Message----- > From: Stanley Bradbury [mailto:Stan.Bradbury@gmail.com] > Sent: Monday, February 27, 2006 1:13 PM > To: Derby Discussion > Subject: Re: Derby Function > > Max Ten wrote: > > > Is there any function for - GROUP BY YEAR(), GROUP BY MONTH(), GROUP > > BY QUARTER() in derby? > > Hi - > There are functions but they are not supported in a GROUP BY clause in > Derby. The workaround (a bit kludgy) is to translate the values > returned by the function to table data values. I do this by creating a > table YrMnDy with a column that list all years in my dataset (col Yr) > and in the column Mn 1-12 and the column Dy 1-31 then using this query > > select label, y.Yr, m.Mn, d.Dy, count(*) > from myData, RptYMD y, RptYMD d, RptYMD m > where year(postdate) = y.Yr > and month(postdate) = m.Mn > and day(postdate) = d.Dy > group by label, y.Yr , m.Mn, d.Dy > > If you don't like aliasing the same table repeatedly or have a lot more > years to list than 31 you may find it cleaner to use different tables > for Yr, Mn and Dy. > > Hope this helps.