I have the table with the two columns `RequestId` and `OldRequestId`.

* If I pass a `RequestId`, it should retrieve me the specific record.
* If the `OldRequestId` is not null in the retrieved record, it should bring the old request data as well.
* It should go on until the `OldRequestId` is null.

Can someone help me to write the best possible SQL query for this requirement?

[![enter image description here](https://i.stack.imgur.com/h2BNF.png)](https://i.stack.imgur.com/h2BNF.png)