I am attempting to flag a record that has gone into "Past Due" status in SQL. I calculate the "Past Due" status using a simple date calculation of Current Date-Due date and once the due date has passed it triggers a past due flag. My issue comes in that once this record has been past due once, my customer wants it to remain showing as past due. (They are able to change the due dates on the front end which when set in the future would make the record no longer past due.) Is there a way I can set up some sort of fixed flag so that once the Due Date > Current date the first time in the workflow that the record shows up as past due until it is closed.
Example for past due flag:
Select
current_date as report_date
,issue_id
,issue_due_date
,case when report_date > issue_due_date then 'Current'
when report_date < issue_due_date then 'Past Due'
From Table
However throughout the issue workflow, users are able to change the due date setting it to a date in the future, which would render the above query to 'Current'. I would like to figure out a way, that once an issue goes into 'Past Due' regardless of what happens to the record moving forward, it is always stay as 'Past Due'.
SQL: Redshift