Page 1 of 1

select help needed

Posted: Sun Feb 15, 2004 8:55 am
by pelegk2
i have DB with 2 columns:
first colums is ID that can repeat itself
and the second column id amount

for exaple

a435f3 12
sadfsaf 10
a435f3 17
wer34 9


i want a print that
a435f3 total of 29
sadfsaf total of 10
wer34 total of 9

thanks in advance
peleg

Posted: Sun Feb 15, 2004 9:26 am
by microthick
This might work. Correct for correct column and table names, first.

$sql = "select id, sum(amount) from sometable group by id";

Might totally fail though.