In my simple table I only want to report rows that pass and report those only once. So the result should have Unit 1 and 2 once.
Thanks,
JH
In my simple table I only want to report rows that pass and report those only once. So the result should have Unit 1 and 2 once.
Thanks,
JH
SELECT Unit
FROM simple_table
GROUP BY Unit
HAVING MAX(CASE WHEN Result = 'pass' THEN 1 ELSE 0 END) = 1 AND
MAX(CASE WHEN Result = 'fail' THEN 1 ELSE 0 END) = 0
ORDER BY Unit
a little simpler
select distinct Unit
from simple_table
where Result = 'pass'
Only if assume a given Unit can't have both Fail and Pass in it ... I'm not willing to assume that at all, given the q was posed.