peterbarone Posted April 9, 2006 Share Posted April 9, 2006 Hello can some one help me figure this out. I have to querys that I'm looking to combine them to get one result. Team Name and Points [code]<?phpinclude 'config.php';$result = mysql_query("SELECT *, sum(points) AS points FROM teams,teamscores WHERE teams.teamid = teamscores.team GROUP BY teamscores.team") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) {print"<table width=\"650px\">";print"<tr><td>$row[teamname]</td><td>$row[points]</td></tr>";print"</table>";} ?><?phpinclude 'config.php';$result = mysql_query("SELECT *, sum(points) AS points FROM playerpoints,players WHERE players.playerid = playerpoints.player GROUP BY player ORDER BY points DESC ") or die("SELECT Error: ".mysql_error()); while($row = mysql_fetch_array( $result )) {print"<table width=\"650px\">";print"<tr><td>$row[playername]</td><td>$row[points]</td></tr>";print"</table>";} ?>[/code]Right now both return a running points total but I need them to be combined into one total for points Link to comment https://forums.phpfreaks.com/topic/6921-multiple-query-question/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.