Re: [SQL] Ordering a date_part() query ...

Поиск
Список
Период
Сортировка
От The Hermit Hacker
Тема Re: [SQL] Ordering a date_part() query ...
Дата
Msg-id Pine.BSF.4.21.0001181842280.23487-100000@thelab.hub.org
обсуждение исходный текст
Ответ на Re: [SQL] Ordering a date_part() query ...  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
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 



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] Ordering a date_part() query ...
Следующее
От: Marten Feldtmann
Дата:
Сообщение: Re: [SQL] index usage ... strange !?