我正在尝试将列添加在一起以获得每列末尾的总数,我搜索了这个主题并尝试按照它所说的去做,但得到了一个错误
您的 SQL 语法有错误;查看与您的 MySQL 服务器版本相对应的手册,了解在 'SELECT SUM(Sea) FROM PlayerStats; 附近使用的正确语法;FROM SeasonStats WHERE SeasonStats.PlayerID=' 在第 2 行
我对此很陌生,似乎无法弄清楚如何使它工作。任何帮助将不胜感激。
$oPlayerStats = mysql_query("
SELECT SeasonStats.Sea, SeasonStats.Team, SeasonStats.GP, SeasonStats.Goals, SeasonStats.Assists, SeasonStats.Points, SeasonStats.PlusMinus, SeasonStats.Pim, SeasonStats.PP, SeasonStats.SH, SeasonStats.GW, SeasonStats.GT, SeasonStats.S
SELECT SUM(Sea) FROM PlayerStats;
FROM SeasonStats
WHERE SeasonStats.PlayerID=$iPlayerID
ORDER BY SeasonStats.Sea;
") or die(mysql_error());
echo "<br><br><table border=1 cellpadding=1>";
echo "<tr>";
echo "<td>Season</td> ";
echo "<td>Team</td> ";
echo "<td>GP</td> ";
echo "<td>G</td> ";
echo "<td>A</td> ";
echo "<td>P</td> ";
echo "<td>PIM</td> ";
echo "<td>+/-</td> ";
echo "<td>PPG</td> ";
echo "<td>SHG</td> ";
echo "<td>GWG</td> ";
echo "<td>GTG</td> ";
echo "<td>Shots</td> ";
while($row = mysql_fetch_array($oPlayerStats))
{
echo "<tr>";
echo "<td>".$row['Sea']."</td> ";
echo "<td>".$row['Team']."</td> ";
echo "<td>".$row['GP']."</td> ";
echo "<td>".$row['Goals']."</td> ";
echo "<td>".$row['Assists']."</td> ";
echo "<td>".$row['Points']."</td> ";
echo "<td>".$row['Pim']."</td> ";
echo "<td>".$row['PlusMinus']."</td> ";
echo "<td>".$row['PP']."</td> ";
echo "<td>".$row['SH']."</td> ";
echo "<td>".$row['GW']."</td> ";
echo "<td>".$row['GT']."</td> ";
echo "<td>".$row['S']."</td> ";
$result = mysql_query('SELECT SUM(Sea) AS value_sum FROM codes');
$row = mysql_fetch_assoc($result);
$sum = $row['value_sum'];