jeudi 26 novembre 2015

SQL - only display rows that have the max value

I have this table that is already sorted but I want it to only display the maximum values... so instead of this table:

+------+-------+
| id   | value | 
+------+-------+
| 1    |  3    | 
| 5    |  3    |
| 4    |  3    |
| 9    |  2    | 
| 8    |  2    |
| 3    |  2    |
| 2    |  1    |
| 6    |  1    |
| 7    |  1    |
+------+-------+

I want this:

+------+-------+
| id   | value | 
+------+-------+
| 1    |  3    | 
| 5    |  3    |
| 4    |  3    |
+------+-------+

I'm using SQLite. thanks for any help.

Aucun commentaire:

Enregistrer un commentaire