tg95 tg95 - 5 months ago 15
SQL Question

need help for my webstore top donator month

i create a webstore and i put a top Donator per month.

My problem is, how i can get "top donator"?

i try in sql query

MAX(money)
but have problem on example:

test 250

test2 3


and say max value is 3

my table:

Date | username | money

2016/7 | tg95 | 10

2016/7 | test | 15


how i can get the top donator perm amount?


sorry for my bad english and thanks for help.


ok table config example:

date | username | money

2016/7 | test | 10

2016/7 | test2 | 15

2016/7 | test3 | 9


on this example max value is test2 = 15
ok maybe more simple is get date ( per month ) and get a max value on money

Answer

Try:

SELECT username FROM Table1 ORDER BY money DESC LIMIT 1;

SQL FIDDLE