From: Tom Lane <tgl@sss.pgh.pa.us>
To: The Hermit Hacker <scrappy@hub.org>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Ordering a date_part() query ...
Date: Tue, 18 Jan 2000 17:26:37 -0500
Message-ID: <2228.948234397@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSF.4.21.0001181702520.23487-100000@thelab.hub.org>
References: <Pine.BSF.4.21.0001181702520.23487-100000@thelab.hub.org>
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...
I'd suggest choosing another name for the field, too ;-)
regards, tom lane
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: tgl@sss.pgh.pa.us, scrappy@hub.org
Subject: Re: [SQL] Ordering a date_part() query ...
In-Reply-To: <2228.948234397@sss.pgh.pa.us>
References: <Pine.BSF.4.21.0001181702520.23487-100000@thelab.hub.org> <2228.948234397@sss.pgh.pa.us>
* 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