If the possible values are only 'Breachend'
and 'Not Breached'
, you can GROUP BY incident_number
and get the minimum as 'Breached' < 'Not Breached'
.
SELECT incident_number,
min(has_breached) has_breached
FROM elbat
GROUP BY incident_number;
1
solved Need SQL Script