Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Returning Range of values where gaps exist
Rene,
I managed to get this to work.
select distinct start_, end_, reader from (
select
first_value(specimen_id) over (partition by diff) start_,
last_value(specimen_id) over (partition by diff) end_,
reader,
row_number() over (partition by diff order by specimen_id) r
from (
select
row_number() over(partition by reader order by specimen_id) -
specimen_id diff,
reader, specimen_id from reading r1 where sample_id = '200201049' and reading_number = 1 and specimen_id not in ( select specimen_id from reading where reading.year=r1.year and reading.sample_id=r1.sample_id and reading.specimen_id=r1.specimen_id and reading_number = 2 )
However, this will return only one SAMPLE_IDs worth of data. I haven't figured out yet how to return each Sample IDs records yet but I am hot on the trail.
I want to thank you for your help. I am much futher along that I would have been by myself!
Sincerely,
Tim Received on Mon Apr 28 2003 - 12:57:51 CDT
![]() |
![]() |