Subject Re: [firebird-support] Is it possible to do this with window function?
Author Mark Rotteveel
On 2-5-2015 10:50, brucedickinson@... [firebird-support] wrote:
> I am having such data:
>
> ID DATE_TIME TYPE
> 1 01.01.2015, 00:00:00.000 A
> 2 01.01.2015, 00:01:00.000 A
> 3 01.01.2015, 00:02:00.000 A
> 4 01.01.2015, 00:10:00.000 B
> 5 01.01.2015, 00:15:00.000 B
> 6 01.01.2015, 00:20:00.000 A
> 7 01.01.2015, 00:25:00.000 A
>
> Is it possible to write query which will result:
>
>
> TYPE DATE_MIN DATE_MAX
> A 01.01.2015, 00:00:00. 000 01.01.2015, 00:02:00.000
>
> B 01.01.2015, 00:10:00.000 01.01.2015, 00:15:00.000
>
> A 01.01.2015, 00:20:00.000 01.01.2015, 00:25:00.000
>
> As you can see I would like to have three groups and not two like it
> would have been with usage of standard GROUP BY. I know I can write a
> selectable stored procedure which will result me such data but is it
> possible to do with new window functions and partitioning?

By what logic do you arrive at this result?

Mark
--
Mark Rotteveel