Hi Team,
Could please provide us the sql query logic to achieve below scenario.
Requirement : we need to compare 2nd row with 1 st row (between start date & end date) , If the 2nd row start date or end date is appearing in between we need to through exception.
like same
We need to compare 3rd row same like as above with 2nd row and 1st row.
4th row with 3rd,2nd,1st…
The Row count is dynamic it may be 1,2,3,4….
<table><tbody><tr><td style="height:14.5pt;width:48pt;"> </td><td style="border-left-style:none;width:48pt;">start date</td><td style="border-left-style:none;width:48pt;">end date</td><td style="border-left-style:none;width:48pt;"> </td></tr><tr><td style="border-top-style:none;height:14.5pt;text-align:right;">1</td><td style="border-left-style:none;border-top-style:none;text-align:right;">Jan2021</td><td style="border-left-style:none;border-top-style:none;text-align:right;">Dec2021</td><td style="border-left-style:none;border-top-style:none;"> </td></tr><tr><td style="border-top-style:none;height:14.5pt;text-align:right;">2</td><td style="border-left-style:none;border-top-style:none;text-align:right;">Mar2021</td><td style="border-left-style:none;border-top-style:none;text-align:right;">Aug2021</td><td style="border-left-style:none;border-top-style:none;"> </td></tr><tr><td style="border-top-style:none;height:14.5pt;text-align:right;">3</td><td style="border-left-style:none;border-top-style:none;text-align:right;">June2021</td><td style="border-left-style:none;border-top-style:none;text-align:right;">Nov2021</td><td style="border-left-style:none;border-top-style:none;"> </td></tr></tbody></table>