pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Creager <Robert_Creager@LogicalChaos.org>
To: teknokrat@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: grouping by date
Date: Thu, 8 Jan 2004 21:59:58 -0700
Message-ID: <20040108215958.791d131c.Robert_Creager@LogicalChaos.org> (raw)
In-Reply-To: <btc61h$2933$1@news.hub.org>
References: <btc61h$2933$1@news.hub.org>

When grilled further on (Mon, 05 Jan 2004 17:14:26 +0000),
teknokrat <teknokrat@yahoo.com> 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

view thread (2+ messages)

Message-ID: <20040108215958.791d131c.Robert_Creager@LogicalChaos.org>
Permalink:  ../20040108215958.791d131c.Robert_Creager@LogicalChaos.org/
Also on:    postgresql.org/message-id/20040108215958.791d131c.Robert_Creager@LogicalChaos.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Robert_Creager@LogicalChaos.org, teknokrat@yahoo.com
  Subject: Re: grouping by date
  In-Reply-To: <20040108215958.791d131c.Robert_Creager@LogicalChaos.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox