You can group by CUSTOMERCODE and FYE

select customercode, fye, min(servicetype)
from table1
group by customercode, fye

min will return F if the customercode and fye are same and serivice types are F or P.