Good Morning,
I'm trying to create a mySQL query with the following output:
In order to get the 60_days_since_seen, I need to compare the reference_date for the current row to the next most recent reference_date relative to the unique_identifier and determine if that reference_date is older than 60 days from the reference_date from that row.
Ex: unique_identifier = 123456789
id = 1: Since there is no date before this instance, the 60_days_since_seen is TRUE (or 1).
id = 2: Since the date of the reference_date occurrence prior to this id relative to the unique_identifier is less than 60 days since this row's reference_date, the 60_days_since_seen is FALSE (or 0).
id = 3: Since the date of the reference_date occurrence prior to this id relative to the unique_identifier is greater than 60 days since this row's reference_date, the 60_days_since_seen is TRUE (or 1).
id = 4: Since there is no date before this instance, the 60_days_since_seen is TRUE (or 1).
id = 5: Since the date of the reference_date occurrence prior to this id relative to the unique_identifier is less than 60 days since this row's reference_date, the 60_days_since_seen is FALSE (or 0).