Hi All,
I have data shown as below and my requirement is to get 1st row and last row from the data set because 1st rows has c4 flag as Y and last row shows 1 as reference to 1st row column c1.
select 1 c1, 1 c2, 1 c3, ‘Y’ c4 from dual union all
select 1 c1, 2 c2, 2 c3, ‘N’ c4 from dual union all
select 1 c1, 3 c2, 3 c3, ‘N’ c4 from dual union all
select 1 c1, 4 c2, 1 c3, ‘N’ c4 from dual;
Thank you in advance for you feedback and please let me know if you have any questions related t the requirement.