Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 331C89FB38B for ; Thu, 10 May 2007 15:34:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 67941-08 for ; Thu, 10 May 2007 15:34:21 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from web54314.mail.yahoo.com (web54314.mail.yahoo.com [206.190.49.124]) by postgresql.org (Postfix) with SMTP id 538EE9FB389 for ; Thu, 10 May 2007 15:34:23 -0300 (ADT) Received: (qmail 10471 invoked by uid 60001); 10 May 2007 18:34:22 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=JtEWAAtyOn+zj1L6mrNahSOOP6aogVvTh1oSFvZR31xC8C/NpmCWQZn4drEmVFfXuwcDhg7IhRbrV85OoCczLSGZdF/SG3BKLoe02s4sYj6QjL6C7ZCR+hAa44fEbHsaZY48blbCQSh9y5kvAerze5HYhPZcgW8qeIgaMXYem+8=; X-YMail-OSG: IiKpVsAVM1n6RNZheOzsf0A9gldaigCcfCeriNrjSvOWa3NR.MlbGyb3C3Owzx3iTXux249pSca3GkdkoRpmSNoHYkHZ2gXyYAMwSNDUJYq9k3onwDllIeat6f2N5RTGB45wjoUZ3fpj2BFPpkwa0zWzFA-- Received: from [24.2.63.115] by web54314.mail.yahoo.com via HTTP; Thu, 10 May 2007 11:34:22 PDT Date: Thu, 10 May 2007 11:34:22 -0700 (PDT) From: chester c young Subject: Re: Count rows by day interval To: Loredana Curugiu Cc: sql pgsql In-Reply-To: <1c23c8e70705100101y63bd0c21g466ca0ee830cdec8@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <248641.9937.qm@web54314.mail.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/80 X-Sequence-Number: 28360 > ... instead of date_trunc('day',sent_messages.date) why don't you have a function that takes four three arguments: - beginning date of query - interval, ie, reminder_services.activity_days_min - timestamp, ie, sent_messages.date have it return the minimum date for that interval as I think I understand your problem, that should work __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com