X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 24547D1B43C for ; Fri, 9 Jan 2004 05:01:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38596-09 for ; Fri, 9 Jan 2004 01:01:03 -0400 (AST) Received: from srvr3.iniquinet.com (srvr2.iniquinet.com [64.240.87.12]) by svr1.postgresql.org (Postfix) with SMTP id 395BCD1B4D4 for ; Fri, 9 Jan 2004 01:01:02 -0400 (AST) Received: (qmail 10908 invoked by uid 104); 9 Jan 2004 04:54:02 -0000 Received: from Robert_Creager@LogicalChaos.org by srvr3.iniquinet.com by uid 101 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.55. Clear:SA:0(-7.5/6.0):. Processed in 35.193612 secs); 09 Jan 2004 04:54:02 -0000 Received: from vsat-148-64-8-86.c119.t7.mrt.starband.net (HELO chaos.mshome.net) (148.64.8.86) by srvr3.iniquinet.com with SMTP; 9 Jan 2004 04:53:26 -0000 Received: from localhost.localdomain (thunder.mshome.net [192.168.0.250]) by chaos.mshome.net (Postfix) with ESMTP id BF5FF1AD32F; Thu, 8 Jan 2004 22:00:05 -0700 (MST) Received: from logicalchaos.org (thunder.mshome.net [192.168.0.250]) by chaos.mshome.net (Postfix) with SMTP id 1AE9B1E5006; Thu, 8 Jan 2004 22:00:04 -0700 (MST) Date: Thu, 8 Jan 2004 21:59:58 -0700 From: Robert Creager To: teknokrat@yahoo.com Cc: pgsql-sql@postgresql.org Subject: Re: grouping by date Message-Id: <20040108215958.791d131c.Robert_Creager@LogicalChaos.org> In-Reply-To: References: Organization: Starlight Vision, LLC. X-Mailer: Sylpheed version 0.9.5claws (GTK+ 1.2.10; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Multipart_Thu__8_Jan_2004_21_59_58_-0700_=.AO88RpC1c9BZnj" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/64 X-Sequence-Number: 16457 --Multipart_Thu__8_Jan_2004_21_59_58_-0700_=.AO88RpC1c9BZnj Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit When grilled further on (Mon, 05 Jan 2004 17:14:26 +0000), teknokrat confessed: > How can I group by date given a timestamp column? > I just found this out this weekend. Try 'date_trunc'. Look at secion 9.8.2 of the documentation. I'm using something like: SELECT date_trunc( 'hour', "when" ) AS "date" FROM readings GROUP BY "date"; Where "when" is my timestamp columnn. Cheers, Rob -- 21:55:40 up 11 days, 11:46, 4 users, load average: 2.09, 2.03, 2.01 --Multipart_Thu__8_Jan_2004_21_59_58_-0700_=.AO88RpC1c9BZnj Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iEYEARECAAYFAj/+NVMACgkQLQ/DKuwDYzn2KgCgjMzxRzakgNaJej09bTu/a0gp IcYAn38DcwGEJSnlC3+yGxl5zNr3q8gj =IY15 -----END PGP SIGNATURE----- --Multipart_Thu__8_Jan_2004_21_59_58_-0700_=.AO88RpC1c9BZnj--