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

2010-04-13 Thread A B
Thank you all who has replied. I will study your suggestions and see what will work best in my case. 2010/4/13 Kenichiro Tanaka : > Hello. > > I try with "With Query". > http://www.postgresql.org/docs/8.4/static/queries-with.html > > #We can use "With Queries" >  v8.4 > #That'll only work if the t

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

2010-04-13 Thread Kenichiro Tanaka
Hello. I try with "With Query". http://www.postgresql.org/docs/8.4/static/queries-with.html #We can use "With Queries" > v8.4 #That'll only work if the time values are contiguous, but there's probably a #similar trick for non-contiguous ,too. --create data drop table foo; create table foo( tim

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

2010-04-12 Thread Steve Atkins
On Apr 12, 2010, at 11:31 AM, Scott Marlowe wrote: > On Mon, Apr 12, 2010 at 12:22 PM, A B wrote: >> Hello! >> >> I have a table (think of it as a table of log messages) >> >> time | message >> --- >> 1 | a >> 2 | b >> 3 | b >> 4 | b >> 5 |

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

2010-04-12 Thread Sergey Konoplev
On 12 April 2010 22:22, A B 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      

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

2010-04-12 Thread Scott Marlowe
On Mon, Apr 12, 2010 at 12:22 PM, A B wrote: > Hello! > > I have a table (think of it as a table of log messages) > > time |  message > --- > 1      |   a > 2      |   b > 3      |   b > 4      |  b > 5      |  a > > the three 'b' are the same message, so I would like to write

[GENERAL] Need some help with a query (uniq -c)

2010-04-12 Thread A B
Hello! I have a table (think of it as a table of log messages) time | message --- 1 | a 2 | b 3 | b 4 | b 5 | a the three 'b' are the same message, so I would like to write a query that would give me a result that is similar to what the unix