-1

what I am looking to do is merge several rows of data to be displayed as a single row. Based on the highest value of a row. So only keep the records with the highest values

FROM THIS:

ContractID Months
140 12.8
140 12.9
140 13.0
130 8.1
130 8.2
126 1.5

TO THIS:

ContractID Months
140 13.0
130 8.2
126 1.5

Any suggestions would be most welcome.

Thanks.

Michiel
  • 29
  • 3

1 Answers1

0

that would be group by and get the max in each group:

select ContractID , max(Months)
from yourtable
group by ContractID
eshirvana
  • 23,227
  • 3
  • 22
  • 38