Viewing 7 posts - 1 through 7 (of 7 total)
Here is the dynamic sql approach:
It returns the found datetimes including the previous and following rows (if present) using then sample data from the post before.
DECLARE
@query AS NVARCHAR(MAX),
@queryWHERE AS NVARCHAR(MAX),
@querySELECT...
September 18, 2015 at 6:22 am
Hello David,
thanks for the script but the performance is truly poor...
I decided do create a dynamic SQL Script :pinch: with, as you mentioned, LEAD() and LAG().
This performs very...
September 18, 2015 at 1:59 am
Here you'll find some more sample data.
For example the Grp value 421 is calculated several times.
Thanks
if object_id('tempdb..#tab1', 'U') is not null
drop table #tab1;
create table #tab1
(
...
September 16, 2015 at 8:01 am
Hello David,
this looks very promising, unfortunately sometimes the value Grp repeats itself on different datetime / item combinations.
Thanks
September 16, 2015 at 7:31 am
Yes, this is my desired result. They don't need to be indicated by an ID.
September 16, 2015 at 5:59 am
the value of 5 was meant as an example for the minimum number of recurrences with the same item
September 16, 2015 at 12:54 am
Viewing 7 posts - 1 through 7 (of 7 total)