X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id D007FCC3E1 for ; Tue, 15 Jul 2003 14:59:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 39823-04 for ; Tue, 15 Jul 2003 14:59:40 +0000 (GMT) Received: from exchange.hq.openratings.com (unknown [141.149.165.226]) by svr1.postgresql.org (Postfix) with ESMTP id 4CAF7CC3CF for ; Tue, 15 Jul 2003 11:59:10 -0300 (ADT) Received: from openratings.com (cancun.hq.openratings.com [10.0.0.225]) by exchange.hq.openratings.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 38QM4CSX; Tue, 15 Jul 2003 10:59:39 -0400 Message-ID: <3F141703.4080904@openratings.com> Date: Tue, 15 Jul 2003 11:00:19 -0400 From: Dmitry Tkach User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: greg@turnstep.com Cc: pgsql-sql@postgresql.org Subject: Re: Count dates distinct within an interval References: <7f2298d39c75726c835ecbf42f0c8e70@biglumber.com> In-Reply-To: <7f2298d39c75726c835ecbf42f0c8e70@biglumber.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/177 X-Sequence-Number: 14291 > > >You need to elaborate on your logic some more, and state exactly what you >would want in the A,B,C case above. Does B get lumped with A or with C? >It is within 24 hours of both, after all. Does C not get lumped in with >B simply because B has already been lumped in with A? > Yes. The first (earliest) entry is counted, then all the later ones a skipped as long as they are within 24 hours from the last one, that's counted. In this case, A is counted, B is skipped, because it is within 24 hours of A, then C is counted, because it is more than 24 hours from A. Thanks! Dima