Re: Group by date

Поиск
Список
Период
Сортировка
От missive@frontiernet.net (Lee Harr)
Тема Re: Group by date
Дата
Msg-id 9m1kdr$peg$1@node21.cwnet.roc.gblx.net
обсуждение исходный текст
Список pgsql-general
On 21 Aug 2001 23:10:08 -0700, Dale Emmons <dale@emmons.com> wrote:
> Hello!
>
> I'm trying to be a convert from mysql, which I feel quite comfortable with.
>
> In mysql I can do the following:
>
> CREATE TEMP TABLE hits (
>      datetime TIMESTAMP
> );
>
> Fill it with some data, and then do this:
>
> SELECT datetime, COUNT(*)
> FROM hits
> GROUP BY DATE(datetime)
>
> When I try that in PostgreSQL I get this error when I try the above query:
> Attribute hits.datetime must be GROUPed or used in an aggregate function
>
> The query works fine in mysql, why not postgres?
>


Try this:

SELECT DATE(datetime), count(*)
FROM hits
GROUP BY DATE(datetime);




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

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re: SELECT FOR UPDATE
Следующее
От: missive@frontiernet.net (Lee Harr)
Дата:
Сообщение: Re: Group by date