Hi,

> Table 1: names
> Id | name
> 15 | George
> 16 | Suzy

> Table 2 : scores_1
> Id | score
> 15 | 85
> 15 | 60
> 15 | 70
> 15 | 95

> Table 3 : scores_2
> Id | score
> 15 | 50
> 15 | 55
> 15 | 60
> 15 | 45

> What I want to end up with is a selection that would pick up George and his
> highest score on score_1 and score_2 (i.e. George 95 60)

mysql> select n.name, max(s1.score), max(s2.score)
    -> from names n, scores_1 s1, scores_2 s2
    -> where n.id = s1.id and n.id = s2.id and
    ->       n.id = 15
    -> group by n.name;
+--------+---------------+---------------+
| name   | max(s1.score) | max(s2.score) |
+--------+---------------+---------------+
| George |            95 |            60 |
+--------+---------------+---------------+
1 row in set (0.00 sec)


Pozdrav,
Sasa



---------------------------------------------------------------------
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