I've been trying GROUP BY and ORDER BY in the same line to get what I want but it's not working.
I am using a while loop that is running thousands of names, checking for highest points in each city.
How do I get the name with highest points from each city, without repeating the same city twice?
This is what's in my database (in short):
ID City       Points    Name
1  NYC        16        Stan
2  London     24        Paul
3  NYC        11        Jeffrey
4  London     20        George
5  NYC        18        Ryan
$query = "SELECT `ID`, `City`, `Points`, `Name` FROM `table` GROUP BY `City` ORDER BY `Points`";
Gives me:
1 NYC 16 Stan
2 London 24 Paul
What I want it to give me:
2  London     24        Paul
5  NYC        18        Ryan
 
     
     
     
    