maybe:
SELECT sum(killed) AS sumKilled FROM myTable WHERE DisGroup LIKE 'Natural'
group by year
vocoder wrote:
This takes rather long....is there some way to optimize this?
for ($year=1975; $year < 2001; $year++)
{
$query = "SELECT sum(killed) AS sumKilled FROM myTable WHERE DisGroup LIKE 'Natural' AND year LIKE $year";
$result = mysql_query($query,$linkID);
$row = mysql_fetch_assoc($result);
$databarx[]=$year;
$databary[] = $row["sumKilled"];
}
i'm putting the results into an array to use in a bar chart..