Tauquir
Tauquir

Reputation: 6913

How to get unique result in mysql

I have table:

name        marks

aaa         100
aaa         56
aaa         120
bbb          56
bbb          60

The result should be:
aaa         120
bbb          60

ie unique name with maximum marks. Is there any query in mysql?

Upvotes: 1

Views: 221

Answers (1)

Michael Pakhantsov
Michael Pakhantsov

Reputation: 25370

 SELECT name, MAX(marks) marks
 from table
 group by name

Upvotes: 1

Related Questions