|
-
Thanks for the reply!
If I understand you correctly, which I think I don't, I would need to know N?
My example might also not have been clear enough - I do not want to insert rows for every missing n - just a single row at any discontinuety.
eg.
Nr Value
-----------
1 10
2 5
10 3
11 8
should become
Nr Value
-----------
1 10
2 5
3 NULL (in fact ... Nr can be anything between 3 and 9 - it will have the same result on the graph in the end)
10 3
11 8
Thanks again for any thoughts
What would probably be possible, but I don't know how elegant or optimal a solution, would be to do something like:
Select
x.NR,
NULL as Value
from
(select
(NR + 1) as NR,
LEAD(NR,1,null) OVER (PARTITION by (some other field ..hehe) ORDER BY NR) - NR as difference from
Some_table ) x where difference > 1
This should produce a record for each discontinuety.
I can then UNION this with the SELECT Nr, Value FROM SOME_TABLE
It should work, but would it be the fastest solution? Most probably not ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|