Lets say I have a table like this called my_table:
f_id name status date
1 12 walnut passed 7/17/2023
2 13 beech passed 7/18/2023
3 12 walnut failed 7/19/2023
4 11 almond failed 7/20/2023
5 13 beech passed 7/21/2023
I know I can get the distinct f_ids and names using:
SELECT DISTINCT(f_id), name, status
FROM my_table
However, what I want it is to get the f_ids and names of the rows where the status = failed but where the status had not previously been 'passed'.
f_id name
1 11 almond
This will require using the date column, but I am not sure how. Suggestions?