I’ve got a big problem with this complicated SQL. Could anyone give me a hand?

My first aim(not the final goal) is:fliter the duplicate data with query statment( select not delete) , that is, the various entries of EndTime and Qos for a same ServiceID due to the repeated feedback. The rule is to only keep the records with the lowest Qos for a same ServiceID. If there are several records having the lowest Qos, then only keep whatever...