sindy: (mysql 5) probleme mit group by

Beitrag lesen

guten morgen,

ich hab da ein mysql problem und komme einfach nicht weiter.
ich habe folgende zwei tabellen:

scores
------
score_id
score
game_id
entry_date

games
------
game_id
name

ich möchte jetzt ein top 10 bekommen, also von jedem spiel die höchste punktezahl, sowie die score.id zum entsprechenden maximum. mein versuch:

SELECT MAX(scores.score) as mscore, scores.score_id AS sid, scores.game_id
FROM scores, games
WHERE scores.game_id = games.id
GROUP BY scores.game_id
ORDER BY scores.entry_date DESC LIMIT 10

jetzt bekomme ich zwar die hiscores, aber eine falsche id dazu... also beispielsweise folgender tabelleninhalt von scores:

score_id  |  score  |  game_id  |
------------------------------
1  |  123  |  1
2  |  234  |  2
3  |  345  |  1

das resultat der abfrage ist dann:

1  |  345  |  1  <-- falsche score_id
2  |  234  |  2

ich verstehe das resultat einfach nicht :(