group by function, make SQL cleaner?

Поиск
Список
Период
Сортировка
От Bryce Nesbitt
Тема group by function, make SQL cleaner?
Дата
Msg-id 4418F52F.4070804@obviously.com
обсуждение исходный текст
Ответы Re: group by function, make SQL cleaner?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: group by function, make SQL cleaner?  (pgsql@yukonho.de)
Re: group by function, make SQL cleaner?  (Stefan Becker <stefan@yukonho.de>)
Список pgsql-sql
I've got a working query:

stage=# SELECT date_trunc('day',endtime),count(*)
FROM eg_event where endtime >= '2006-02-01' and endtime < '2006-03-01'
GROUP BY  date_trunc('day',endtime)
ORDER BY date_trunc('day',endtime);
    date_trunc      | count
---------------------+-------2006-02-01 00:00:00 |   2532006-02-02 00:00:00 |   2452006-02-03 00:00:00 |
2312006-02-0400:00:00 |   3132006-02-05 00:00:00 |   2852006-02-06 00:00:00 |   1942006-02-07 00:00:00 |
2292006-02-0800:00:00 |   2392006-02-09 00:00:00 |   2502006-02-10 00:00:00 |   2452006-02-11 00:00:00 |   275
 

Is there a way to eliminate the ugly repeated use of
date_trunc('day',endtime)?



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

Предыдущее
От: Aarni Ruuhimäki
Дата:
Сообщение: Re: Copying a row within table
Следующее
От: Tom Lane
Дата:
Сообщение: Re: group by function, make SQL cleaner?