I have table with a enum column with possible values of 'relative' and 'absolute'. There maybe duplicate rows with the difference being that column.
So normally I would select a row with the 'absolute' value but I need and if caluse to check if there is a 'duplicate' row where the column is 'relative' and then select that row instead (if there is a reletive row, there will always be absolute row too)
pseudo code:
select *
from table
where non_unique_col = 123
and IF (has result row with 'relative'
then return that row
else return 'absolute' row)