meilleur score uniquement

This commit is contained in:
2026-03-16 15:45:04 +01:00
parent 0074e735a8
commit e1f022a5a2

View File

@@ -137,10 +137,11 @@ public class GestionnaireBDD {
}
public Object[][] getLeaderboardData() {
String sql = "SELECT u.identifiant, p.score, p.date_partie, p.campagne_id, p.difficulte_id " +
String sql = "SELECT u.identifiant, MAX(p.score) AS score, p.date_partie, p.campagne_id, p.difficulte_id " +
"FROM parties p " +
"JOIN utilisateurs u ON p.utilisateur_id = u.id " +
"ORDER BY p.score DESC LIMIT 10";
"GROUP BY p.campagne_id, p.difficulte_id " +
"ORDER BY p.campagne_id ASC, p.difficulte_id ASC";
List<Object[]> data = new ArrayList<>();
try (Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql)) {