[MySQL] Delete duplicate entries with less score *SOLVED*
Posted: Wed Mar 14, 2007 12:06 pm
Hi.
I have a MySQL question. Maybe someone has can help me here.
Let's say we have the following table
Is there a single SQL-Statement that deletes all duplicate entry concerning
the name where the score is less the maximum score.
So, that the remaining table would look like this :
I would think about using PHP with getting all the different names using
the DISTINCT command and then gettint the maximum score
of each username and then delete all entries of the user with less score.
Nevertheless, I asked myself if this could be handled by just one clever
SQL-Statement
Any help appreciated.
I have a MySQL question. Maybe someone has can help me here.
Let's say we have the following table
Code: Select all
[b]highscore[/b]
+--------+-------+
| name | score |
+--------+-------+
| bob | 10 |
| bob | 20 |
| anne | 13 |
| anne | 15 |
+--------+-------+
the name where the score is less the maximum score.
So, that the remaining table would look like this :
Code: Select all
[b]highscore[/b]
+--------+-------+
| name | score |
+--------+-------+
| bob | 20 |
| anne | 15 |
+--------+-------+
the DISTINCT command and then gettint the maximum score
of each username and then delete all entries of the user with less score.
Nevertheless, I asked myself if this could be handled by just one clever
SQL-Statement
Any help appreciated.