Re: Need some help with a query (uniq -c) - Mailing list pgsql-general

From Sergey Konoplev
Subject Re: Need some help with a query (uniq -c)
Date
Msg-id g2sc3a7de1f1004121145q58dccbaeo2c189e028520ac32@mail.gmail.com
Whole thread Raw
In response to Need some help with a query (uniq -c)  (A B <gentosaker@gmail.com>)
List 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 by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Need some help with a query (uniq -c)
Next
From: Steve Atkins
Date:
Subject: Re: Need some help with a query (uniq -c)