From: The Hermit Hacker <scrappy@hub.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Ordering a date_part() query ...
Date: Tue, 18 Jan 2000 18:43:09 -0400 (AST)
Message-ID: <Pine.BSF.4.21.0001181842280.23487-100000@thelab.hub.org> (raw)
In-Reply-To: <2228.948234397@sss.pgh.pa.us>
On Tue, 18 Jan 2000, Tom Lane wrote:
> The Hermit Hacker <scrappy@hub.org> writes:
> >> Uh, why don't you just GROUP BY and ORDER BY stat_period?
>
> > Okay, maybe I'm misunderstanding GROUP BY, but my understanding is that it
> > groups "like" values ... my above example would give me a count of all
> > impressions received over a one hour period ...
>
> Oh, so "stat_period" is not a period label but an exact timestamp,
> and you want to group into hourly blocks? OK, then group/order by
> date_trunc("hour", stat_period) is probably what you want...
good, ya had me worried I missed something in the docs on this one :)
> I'd suggest choosing another name for the field, too ;-)
*grin* I'm the only one that accesses it, so it doesn't much matter
Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: scrappy@hub.org, tgl@sss.pgh.pa.us
Subject: Re: [SQL] Ordering a date_part() query ...
In-Reply-To: <Pine.BSF.4.21.0001181842280.23487-100000@thelab.hub.org>
References: <2228.948234397@sss.pgh.pa.us> <Pine.BSF.4.21.0001181842280.23487-100000@thelab.hub.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