[firebird-support] Re: Is it possible to do this with window function?

2015-05-03 Thread brucedickin...@wp.pl [firebird-support]
Svein, this is amazingly smart solution. Took me like one hour to understand what is going on :-) I suggested window functions becausue I thought they would be most effective in solving this. Yes there can be holes in sequence in my data,but thank you for your time and proposing this solution!

[firebird-support] Re: Is it possible to do this with window function?

2015-05-03 Thread brucedickin...@wp.pl [firebird-support]
I think I've found ellegant and simple solution. However, I am afraid it might be very slow for large amount of data :( Test data with holes in sequence: INSERT INTO MYTABLE (ID, DATE_TIME, TYPE) VALUES ('1', '01.01.2015, 00:00:00.000', 'A'); INSERT INTO MYTABLE (ID, DATE_TIME, TYPE) VALUES

[firebird-support] Re: Is it possible to do this with window function?

2015-05-03 Thread brucedickin...@wp.pl [firebird-support]
I've posted my solution but I did not appear so I am reposting it. I found simple solution. The test data: INSERT INTO MYTABLE (ID, DATE_TIME, TYPE) VALUES ('1', '01.01.2015, 00:00:00.000', 'A'); INSERT INTO MYTABLE (ID, DATE_TIME, TYPE) VALUES ('5', '01.01.2015, 00:01:00.000', 'A'); INSERT

[firebird-support] Re: Is it possible to do this with window function?

2015-05-03 Thread brucedickin...@wp.pl [firebird-support]
By what logic do you arrive at this result? I don't know if I can explain it any better. I want to find clusters of A, B, C and so on, group them into one row, get the starting date from first found row and ending date from the last found row in cluster.

[firebird-support] Re: Is it possible to do this with window function?

2015-05-03 Thread brucedickin...@wp.pl [firebird-support]
Svein, if you could be so kind and show me solution which includes holes in sequence that would be great. Once again, thank you :)