Foreach里面的where语句?

I have a database where I am trying to display the top 20 players in my game server. I am retrieving all 20 people back from my database, but I'd like to display their name as well as the amount of "points" they have. My issue is that in the table where it displays the top 20, it does not show their last known alias, and I need to then search in another table clients to match the player ID with the last known alias, but how would I do a foreach on the clients to match all 20 players with their alias, it will only return the first alias as can be seen in the foreach query.

Query on top 20 players -

$query = "
       SELECT * 
FROM  `xlr_playerstats` 
ORDER BY  `xlr_playerstats`.`kills` DESC 
LIMIT 0 , 20
";      
try 
{
    $stmt = $b3->prepare($query); 
    $stmt->execute(); 
} 
catch(PDOException $ex) 
{  
    die("Failed to run query: " . $ex->getMessage()); 
} 
$rows = $stmt->fetchAll();

This then returns the "client id" that I need to cross reference the clients table for the last known alias. I then attempt to do a foreach query on all of these ID's to get back the alias, but it will only return back the first loop in the foreach.

foreach($rows as $row):
$query = "
       SELECT * 
FROM  `clients` 
WHERE id = ".$row["client_id"]."
";      
try 
{
    $stmt = $b3->prepare($query); 
    $stmt->execute(); 
} 
catch(PDOException $ex) 
{  
    die("Failed to run query: " . $ex->getMessage()); 
} 
$names = $stmt->fetch();
endforeach;

How can I use the foreach to get back a successful query with all 20 of my clients alias'?

I think you want to use a join.

SELECT *
FROM  `xlr_playerstats` 
INNER JOIN `clients` ON `clients`.`id` = `xlr_playerstats`.`client_id`
ORDER BY  `xlr_playerstats`.`kills` DESC 
LIMIT 0 , 20