select USERS.Name, Count(WINS.user_id) >From USERS inner join WINS on WINS.user_id = USERS.id Group By USERS.Name
>>> René Fournier <[EMAIL PROTECTED]> 7/29/05 4:40 PM >>> 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 canin one SELECT statementfetch 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]