Re: [SQL] grouping subsets

2010-07-31 Thread Rainer Stengele
The analysis will have to be done over a calendar range which the user selects via web interface. So - yes - normally not the whole table, but maybe he chooses one month and thats already a lot of rows in the table ... Best, too, Rainer Am 30.07.2010 17:07, schrieb Oliveiros d'Azevedo Cristina:

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
I See. And the analysis you need to do, the sum of the rows with the same keys (until they change) will have to be done over all table? Or just over some predefined interval ? Best, Oliveiros - Original Message - From: "Rainer Stengele" Newsgroups: gmane.comp.db.postgresql.sql To: "

Re: [SQL] grouping subsets

2010-07-30 Thread Rainer Stengele
the table may include up to maybe 30 entries per day, average maybe 10-15 After a year this makes about 10.000 entries - maximum, average about 5000 entries. For the problem described I have to use a Microsoft SQL database and would like to use pure SQL. As I use postgres on my Linux servers I f

Re: [SQL] grouping subsets

2010-07-29 Thread Oliveiros d'Azevedo Cristina
Fine. Please advice me, How long can your table be? Thousands? Millions of records? Do you really need it in pure SQL ? It seems to me that it might be possible, I'm just affraid that the query would become too complex and thus slow... Best, Oliveiros - Original Message - From: "R

Re: [SQL] grouping subsets

2010-07-29 Thread Rainer Stengele
No. This is by accident. We have to assume that the combinations do change anytime, and many times per day. So "Or is it possible to have the same combination on one day with several sets?" YES! Rainer Am 29.07.2010 13:47, schrieb Oliveiros d'Azevedo Cristina: > Yes. This is somewhat more

Re: [SQL] grouping subsets

2010-07-29 Thread Oliveiros d'Azevedo Cristina
Yes. This is somewhat more complicated because it has more constraints. I've noticed that a given combination doesn't appear with holes on a certain day. For ex, on a daily basis, we have every three key combinations together. We dont have things like 2010-7-01 1726 3212 1428 2010-7-01 1726

Re: [SQL] grouping subsets

2010-07-29 Thread Rainer Stengele
Howdy Cristina, unfortunately things are more complicated. I have inserted an excerpt of the real data here: TableID MasterID dtBegin dtEnd idR id

Re: [SQL] grouping subsets

2010-07-27 Thread Oliveiros d'Azevedo Cristina
Howdy, Rainer. It's been 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 problem is that I suspect that if you have several t

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
Hi Oliveiros, 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 all the rows. Hop

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, having a table si

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