group by query issue

Posted by user319088 on Stack Overflow See other posts from Stack Overflow or by user319088
Published on 2010-04-17T06:19:45Z Indexed on 2010/04/17 6:23 UTC
Read the original article Hit count: 244

Filed under:

gorup by query issue i have one table, which has three fields and data.

Name , Top , total

cat , 1 ,10

dog , 2, 7

cat , 3 ,20

hourse 4, 4

cat, 5,10

Dog 6 9

i want to select record which has highest value of "total" for each Name

so my result should be like this.

Name , Top , total

cat , 3 , 20

hourse , 4 , 4

Dog , 6 , 9

i tried group by name order by total, but it give top most record of group by result.

any one can guide me , please!!!!

© Stack Overflow or respective owner

Related posts about mysql-query