I have a table (really, a result of a query) that has the following attributes:
Continent
Group_name
job_name
status
run_time
For a given job, there can be a status of 'running', 'completed', or 'failed'. Sometimes, a job will fail, and then run again. Or a job my be running forever, and another job will start. So in some cases, a job may have two entries with 2 different statuses (ex. 'failed' and 'complete'). In these cases, I only want one entry. Anytime one of the entries is 'complete', I would want to eliminate the other entry.
How would I go about doing this? How do I conditionally eliminate 'overlapping' entries?
Edit:
One option I thought of was joining the table on itself (using the WITH clause since my table is actually a query). However I'm not sure how I can get that to work, or what conditions to set so that only one of the two wanted entries are returned.