Q: I have the following table "grades":

+--------+--------+
|  name   |  score  |
+--------+--------+
|   John  |    10     |
+--------+--------+
|   John  |     8      |
+--------+--------+
|   Carl   |    10     |
+--------+--------+
|   Mary  |    6      |
+--------+--------+

I want to select  distinct names (no duplicates) with a score (for my
purposes any score will do for a given name, i.e. John 10, or John 8 would
be fine but not both). So I want a result to be something like:
+--------+--------+
|   John  |     8      |
+--------+--------+
|   Carl   |    10     |
+--------+--------+
|   Mary  |    6      |
+--------+--------+

At first I tried  "SELECT distinct name, score FROM grades"; however, this
returns all rows as John 10 and John 8 ROWS are still distinct. Any ideas
how to get distinct names for this select?


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to