[thelist] PHP/MySQL/sum()

Richard Bennett richard.bennett at skynet.be
Sun Apr 9 04:38:02 CDT 2006


On Sunday 09 April 2006 10:04, rogerharness at comcast.net wrote:
> $query = "select * from my_table where unique_id = '$unique_id'";
Hi,
Replacing the above with something like this should do it:
$query = "select unique_id, max(name) as name, sum(hours) as hours from 
my_table where unique_id = '$unique_id' group by unique_id";

Hope that's what you meant.

Richard



More information about the thelist mailing list