title: I need to write a query to mark previous record as “Not eligible ” if a new record comes in within 30 days with same POS Order ID
body: <p>I have a requirement to write a query to retrieve the records which have POS_ORDER_ID in the table with same POS_ORDER_ID which comes within 30days as new record with status 'Canceled', 'Discontinued' and need to mark previous POS_ORDER_ID record as it as not eligible</p>
  <p>Table columns:</p>
  <p>POS_ORDER_ID,
  Status,
  Order_date,
  Error_description</p>