Jump to content

Archived

This topic is now archived and is closed to further replies.

peterbarone

multiple query question

Recommended Posts

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]
<?php
include '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>";
}
?>

<?php
include '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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.