you have several problems here
first, you say you're looking for a date, but then you say you want to use a status_id
second, your CASE is missing the THEN clauses
finally, your outer query references the non-existent bps table and fails to use the MAX value of the derived table subquery, which is also missing its alias
wanna try again?
