Code Comments
Programming Forum and web based access to our favorite programming groups.You only need LEFT JOIN when you want to pull data from a table even
though there is no matching record in the right table.
--------
sql = "SELECT stat.playerid, player.firstname,
SUM(stat.pts) as totalpts
FROM player INNER JOIN stat ON
player.playerid = stat.playerid
INNER JOIN game ON stat.gameid =
game.gameid
WHERE game.eventid = 7
GROUP BY stat.playerid,
player.firstname
ORDER BY totalpts DESC";
res = mysql_query(sql);
while (list(id, name, pts) =
mysql_fetch_row(res)) {
echo "id name
: pts<br>";
}
--------
hth
Barand
http://members.aol.com/barryaandrew...agridguide.html easy
data tables - and more
----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.