X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 51E1BCC050 for ; Tue, 15 Jul 2003 14:54:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 02061-02 for ; Tue, 15 Jul 2003 14:54:36 +0000 (GMT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id D828FCB9AA for ; Tue, 15 Jul 2003 11:54:11 -0300 (ADT) Received: (qmail 11707 invoked from network); 15 Jul 2003 14:54:41 -0000 Received: from biglumber.com (HELO localhost) (207.228.252.42) by 0 with SMTP; 15 Jul 2003 14:54:41 -0000 From: greg@turnstep.com To: pgsql-sql@postgresql.org Cc: dmitry@openratings.com Cc: dmitry@openratings.com Subject: Re: Count dates distinct within an interval X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <3F1410CB.9020504@openratings.com> Date: Tue, 15 Jul 2003 14:54:41 -0000 X-Mailer: JoyMail 1.37 Message-ID: <7f2298d39c75726c835ecbf42f0c8e70@biglumber.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/174 X-Sequence-Number: 14288 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > Now, I want to count the occurences of each value of stuff in the table, > but so that entries within 24 hours from each other count as one... >... > A = 2001 - 01- 01 20:20:00 > B = 2001 - 01 - 02 20:19:00 > C = 2001 - 01 - 02 20:21:00 > Should be counted as *two* (A === B, and B === C, but *not* A === C)... 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? Perhaps showing us the sample output of an ideal query would be best, along with some sample rows (e.g. use real insert statements) - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200307151045 -----BEGIN PGP SIGNATURE----- Comment: http://www.turnstep.com/pgp.html iD8DBQE/FBS9vJuQZxSWSsgRAnk3AJ0bqyDk6iZWqSZuHfZslFCjxwl7fgCfaZ7r XdwpPsO4OaTa9YpjmXx1hmA= =IFRz -----END PGP SIGNATURE-----