I am trying to write a SQL Query. If a duplicate SNO+SG Combination is found, we need to pick up the one having the highest value. If no duplicate value is found for a SNO+SG Combination, we will take that as it is. The sample input and output is over here:
Do you just want aggregation:
select bg, sno, sg, max(value)
from t
group by bg, sno, sg;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.