Sql query consolidation

Hi guys,

How would i go about querying my sql database and consolidating the results using PHP. For example…

Table 1 -

name amount
person_1 1
person_2 7
person_1 4
person_2 3

Current query

SQL = ' SELECT name, amount FROM table 1'
$query = mysql_query($query) or die (mysql_error());
while ($row = mysql_query($query) {
       echo "Name =" $row['name'] .   "Amount =" $row['amount'];
}

Obviously that would display the result very similar to the above table. However i want it to consolidate so using the same data it would look like this…

name amount
person_1 5
person_2 10

Any suggestions how i would go about this??

thanks in advance.

MySQL :: MySQL 5.0 Reference Manual :: 11.15.1 GROUP BY (Aggregate) Functions

Ah thanks, easy when you know how. I’ve bookmarked the page for future ref.

Thanks again.