I have table like this:
Name Result
T1 fail
T2 pass
T3 pass
T2 fail
T4 fail
T1 pass
T4 fail
Now, I want to get a results like this:
Name Result
T1 pass
T2 pass
T3 pass
T4 fail
I tried using query like this, but it does not work.
select (case when Result = "pass" then "pass" else "fail" end) as Final_verdict,
Name from table_1 group by Name
Can anyone please tell me what am I missing?
EDIT
Try the following:
This should return
passwhenever there is one passed record for a row, aspassis lexicographically afterfail.Use
elseinstead of the secondthen, and useendat the end of thecase.You might also have to use single quotes.
What do you expect to happen when the same name has different results?