I'm trying to SUM multple columns from a table using the follow query.
$res1 = $db->prepare('SELECT sum(kill) as kill,
SUM(death) as death, SUM(assist)as assit FROM eventgame GROUP BY player');
$res1->execute();
while ($row = $res1->fetch(PDO::FETCH_ASSOC)) {
echo '.$row['player'] .$row['kill'] .$row['death'] .$row['assit'].';}
what I'm trying to do is get the total from each player, like:
PLAYER | kill | death | assit
player1 | 10 | 5 | 26
player2 | 5 | 10 | 35
I have been trying this for the last 2 days or so before come here ask for help.
I'm using PDO to connect to my DB.