Re: [SQL] grouping subsets

2010-07-31 Thread Rainer Stengele
4267067 298690 2010-07-05 00:59:15.187 >>>>>> 2010-07-05 01:32:48.300 1726 3212 1428 333 >>>>>> 4270023 298734 2010-07-05 01:59:02.497 >>>>>> 2010-07-05 02:32:48.780

Re: [SQL] grouping subsets

2010-07-30 Thread Joshua Tolley
On Thu, Jul 22, 2010 at 11:31:23AM +, Tim Landscheidt wrote: > Richard Huxton wrote: > > >>> 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

Re: [SQL] grouping subsets

2010-07-30 Thread Oliveiros d'Azevedo Cristina
b.c) = '-1 day'::interval) ) ) th ON fo.a = th.b AND fo.b <= th.c GROUP BY fo.parcela,fo.a,fo.b,fo.c ) tudo GROUP BY tudo.a,tudo.c,tudo.d To: Sent: Thursday, July 22, 2010 9:09 AM Subject: [SQL] grouping subsets Hi, having a table similar to | 1 | B | [2010-07-15 Do] | |

Re: [SQL] grouping subsets

2010-07-30 Thread Rainer Stengele
gt;>> L, ID B, but (!) >>>> rows with same keys (R,L,B) should be summed up only until the keys change. >>>> Do not sum up the components for identical keys, if there are other keys >>>> between them. >>>>

Re: [SQL] grouping subsets

2010-07-29 Thread Oliveiros d'Azevedo Cristina
le b ON (b.b <> a.b) AND ((age(a.c,b.c) = '-1 day'::interval) ) ) th ON fo.a = th.b AND fo.b <= th.c GROUP BY fo.parcela,fo.a,fo.b,fo.c ) tudo GROUP BY tudo.a,tudo.c,tudo.d To: Sent: Thursday, July 22, 2010 9:09 AM Subject: [SQL] grouping subsets Hi, having a table simi

Re: [SQL] grouping subsets

2010-07-29 Thread Rainer Stengele
a while, so I don't know if you are still interested in this >>> problem or if you, in the meantime, found yourself a solution, >>> but I've tried this on a local copy of the example you provided and it >>> seems to work. >>> >>> The prob

Re: [SQL] grouping subsets

2010-07-29 Thread Oliveiros d'Azevedo Cristina
,fo.a,fo.b,fo.c ) tudo GROUP BY tudo.a,tudo.c,tudo.d To: 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-1

Re: [SQL] grouping subsets

2010-07-29 Thread Rainer Stengele
OUP BY se.a,se.b,se.c > ) fo > LEFT JOIN > ( > SELECT a.* > FROM yourTable a > JOIN yourTable b > ON (b.b <> a.b) > AND ((age(a.c,b.c) = '-1 day'::interval) > ) > ) th > ON fo.a = th.b > AND fo.b <= th.c > GROUP BY fo.parcela,fo.a,fo.b,fo.c >

Re: [SQL] grouping subsets

2010-07-27 Thread Oliveiros d'Azevedo Cristina
l) ) ) th ON fo.a = th.b AND fo.b <= th.c GROUP BY fo.parcela,fo.a,fo.b,fo.c ) tudo GROUP BY tudo.a,tudo.c,tudo.d To: 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] | |---+---+-

Re: [SQL] grouping subsets

2010-07-22 Thread Tim Landscheidt
Rainer Stengele wrote: > yes, the date is always incremented - but anyway the date > column is not really the point! Actually the first tow > columns are relevant. I want them gouped together as > indicated, adding up column 1 in the blocks with identical > second column, but not adding up over a

Re: [SQL] grouping subsets

2010-07-22 Thread Rainer Stengele
gt; The dates always follow that sequential pattern? > > Or can be holes on the dates sequence? > > Best, > Oliveiros > > - Original Message - From: "Rainer Stengele" > > To: > Sent: Thursday, July 22, 2010 9:09 AM > Subject: [SQL] grouping s

Re: [SQL] grouping subsets

2010-07-22 Thread Oliveiros d'Azevedo Cristina
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" To: Sent: Thursday, July 22, 2010 9:09 AM Subject: [SQL] grouping subsets Hi, havi

Re: [SQL] grouping subsets

2010-07-22 Thread Tim Landscheidt
Richard Huxton wrote: >>> 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? >> I think, the problem is that

Re: [SQL] grouping subsets

2010-07-22 Thread Richard Huxton
On 22/07/10 11:02, A. Kretschmer wrote: In response to Rainer Stengele : 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? I think, t

Re: [SQL] grouping subsets

2010-07-22 Thread A. Kretschmer
In response to Rainer Stengele : > 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 | [201

[SQL] grouping subsets

2010-07-22 Thread Rainer Stengele
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