pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
To: pgsql-sql@postgresql.org
To: Rainer Stengele <rainer.stengele@diplan.de>
Subject: Re: grouping subsets
Date: Thu, 22 Jul 2010 14:18:09 +0100
Message-ID: <6FDFC090436D4DA98EBB99D0757B5930@marktestcr.marktest.pt> (raw)
References: <i28ubc$ie9$1@dough.gmane.org>

Howdy, Rainer.

Please advice me,

The dates always follow that sequential pattern?

Or can be holes on the dates sequence?

Best,
Oliveiros

----- Original Message ----- 
From: "Rainer Stengele" <rainer.stengele@diplan.de>
To: <pgsql-sql@postgresql.org>
Sent: Thursday, July 22, 2010 9:09 AM
Subject: [SQL] grouping subsets


> Hi,
>
> having a table similar to
>
> | 1 | B | [2010-07-15 Do] |
> | 1 | B | [2010-07-16 Fr] |
> |---+---+-----------------|
> | 2 | C | [2010-07-17 Sa] |
> | 2 | C | [2010-07-18 So] |
> |---+---+-----------------|
> | 1 | B | [2010-07-19 Mo] |
> | 1 | B | [2010-07-20 Di] |
> | 1 | B | [2010-07-21 Mi] |
> | 1 | B | [2010-07-22 Do] |
> |---+---+-----------------|
> | 3 | D | [2010-07-23 Fr] |
>
> a simple group by gives me:
>
> | 6 | B |
> | 4 | C |
> | 3 | D |
>
>
> What I want to get is the values grouped by "subset", where a subset is a 
> set of rows with identical column until the colum changes.
> Is there a way to get
>
> | 2 | B |
> | 4 | C |
> | 4 | B |
> | 3 | D |
>
> by SQL only?
>
> - Rainer
>
>
>
>
>
> -- 
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql 




view thread (16+ messages)  latest in thread

Message-ID: <6FDFC090436D4DA98EBB99D0757B5930@marktestcr.marktest.pt>
Permalink:  ../6FDFC090436D4DA98EBB99D0757B5930@marktestcr.marktest.pt/
Also on:    postgresql.org/message-id/6FDFC090436D4DA98EBB99D0757B5930@marktestcr.marktest.pt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: oliveiros.cristina@marktest.pt, rainer.stengele@diplan.de
  Subject: Re: grouping subsets
  In-Reply-To: <6FDFC090436D4DA98EBB99D0757B5930@marktestcr.marktest.pt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox