Let's say I have two tables:

USERS

id   name
1    John
2    Mary
3    Sue
4    Paul
5    David


WINS
id    user_id
1    2
2    4
3    3
4    5
5    1
6    4
7    4
8    2
9    3
10   1


How can—in one SELECT statement—fetch and display all the users, along with the number of games they each one, e.g.:

User    Games Won
----------------
John      2
Mary      2
Sue       2
Paul      3
David     1



Is this a job for Subselects?

...Rene
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to