Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5A850664C for ; Thu, 9 Jun 2011 16:36:54 +0000 (UTC) Received: (qmail 65962 invoked by uid 500); 9 Jun 2011 16:36:52 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 65911 invoked by uid 500); 9 Jun 2011 16:36:52 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 65903 invoked by uid 99); 9 Jun 2011 16:36:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2011 16:36:52 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2011 16:36:45 +0000 Received: by qyk10 with SMTP id 10so1094010qyk.11 for ; Thu, 09 Jun 2011 09:36:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.18.70 with SMTP id v6mr721169qaa.316.1307637384407; Thu, 09 Jun 2011 09:36:24 -0700 (PDT) Received: by 10.229.236.199 with HTTP; Thu, 9 Jun 2011 09:36:24 -0700 (PDT) X-Originating-IP: [2.32.163.171] In-Reply-To: <4DF0F44C.7010507@cloudant.com> References: <4DF0E44E.8020601@altraqua.com> <4DF0EF7B.6020604@altraqua.com> <4DF0F44C.7010507@cloudant.com> Date: Thu, 9 Jun 2011 18:36:24 +0200 Message-ID: Subject: Re: how to sum values of a view in a date range? From: Fabio Di Bernardini To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=bcaec51b9fb9caeafa04a54a0dc2 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec51b9fb9caeafa04a54a0dc2 Content-Type: text/plain; charset=ISO-8859-1 I need to make a chart with hourly sum of values restricted to March. So I don't need one number with the sum of whole March month. 2011/6/9 David Hardtke > Hi Fabio, > > This should work. You can use the _sum builtin as reduce: > > "reduce":"_sum" > > You then need to query your view with the proper group level and a startkey > and endkey: > > GET > db/_design/power/_view/watt?group_level=2&startkey=[2011,3]&endkey=[2011,4]&inclusive_end=false > > That gives you the sum for the month of March. > > > > > On 06/09/11 09:06, Fabio Di Bernardini wrote: > >> Il 09/06/2011 17:18, Fabio Di Bernardini ha scritto: >> >>> If I have a map function emitting a timestamp as key ad a number as >>> document, how to get sum of values selecting a date range? >>> >> >> More datails here: >> >> http://stackoverflow.com/questions/6294794/how-to-sum-values-of-a-view-in-a-date-range-using-couchdb >> > > --bcaec51b9fb9caeafa04a54a0dc2--