I want to join two tables. Tables are following below,
Table A:
Batch_ID INT,
Start_Dt DATE,
Expiry_Dt DATE
Table B:
Purchase_Dt DATE
I need to get two oldest batch code for each purchase date. Purchase date should be greater than or equal to start_dt and expiry_dt should be less than or equal to purchase date.