Results Combine Rows by Column 1 Then SUM by Column 2 into Total THEN Order by D

I have a database with 4 columns:
Location
Date
Team_Name
Score

I need the results page to SELECT AND combine “Team_Name” WHEN equal and SUM “Score” AS Total and only show the current month at an individual location “BW3Avon”.

Here is my code

http://www.phphelp.com/images/php.png<?php
$con = mysql_connect(“localhost”,“","*”);
if (!$con)
{
die('Could not connect: ’ . mysql_error());
}
mysql_select_db(“x0kqgoub_bw3avonscore”, $con);

$sql = “SELECT * FROM bw3avonscore WHERE MONTH(myDate) = MONTH(CURRENT_DATE)”;

$result = mysql_query(“SELECT * FROM bw3avonscore IF Team_Name = Team_Name THEN SUM(Score) AS Total ORDER BY Total DESC”);

while($row = mysql_fetch_array($result))
{
echo $row[‘Team_Name’] . " " . $row[‘Score’];
echo “
”;
}
mysql_close($con);
?>" http://www.phphelp.com/images/php.png

Sponsor our Newsletter | Privacy Policy | Terms of Service