|
-
Try this.
select id
from ( select id, code,
lag(code,1) over (partition by id order by code) prev_code1,
lead(code,1) over (partition by id order by code) next_code1,
lead(code,2) over (partition by id order by code) next_code2
from your_table)
where prev_code1 is null
and next_code2 is null
and next_code1 = 202
and code = 201
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
|