I have a sqlite3 table like this:
sqlite> select * from scores;
team Name score
---------- --------- ----------
A Name1 93
A Name2 96
A Name3 78
A Name4 82
B Name5 83
B Name6 30
B Name7 99
B Name8 71
B Name8A 45
B Name8C 70
c Name9 87
c Name10 87
c Name11 81
c Name12 71
c Name13 91
There are many teams (about 30 teams), each team has many members (more than 10,000 records in real). I just wanna got the First N winners of each team like this (for simplification, N=3 in this example):
A Name2 96
A Name1 93
A Name4 82
B Name7 99
B Name5 83
B Name8 71
C Name13 91
C Name9 87
C Name10 87
and they are ranked by their score withing the same team.
how to get this result using sqlite3 query? anyone can give some clue? thanks very much.
btw, the 'Name' field are NOT unique, only (team, name) is UNIQUE, that means same name can appear in different team.