Re: Need some help with a query (uniq -c)

Поиск
Список
Период
Сортировка
От Sergey Konoplev
Тема Re: Need some help with a query (uniq -c)
Дата
Msg-id g2sc3a7de1f1004121145q58dccbaeo2c189e028520ac32@mail.gmail.com
обсуждение исходный текст
Ответ на Need some help with a query (uniq -c)  (A B <gentosaker@gmail.com>)
Список pgsql-general
On 12 April 2010 22:22, A B <gentosaker@gmail.com> wrote:
>
> first |  message | last | count
> --------------------------------------
> 1     |     a              |   1   |     1
> 2     |     b              |   4   |     3     <--- here it squeezes
> similar consecutive messages into a single row
> 5     |     a              |   5   |     1
>
> How do I write such a command?

select min(time) as first, max(time) as last, message, count(*) from
log_table group by message order by 1;

--
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp / ICQ: 29353802

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Need some help with a query (uniq -c)
Следующее
От: Steve Atkins
Дата:
Сообщение: Re: Need some help with a query (uniq -c)