select tablename.*, tb1.sum_somefield from (
select max(id) mxid, sum(somefield) sum_somefield
from tablename group by Name
) tb1, tablename
where tablename.id=tb1.mxid
Date :
2017-05-20 10:42:42
By :
Chaidhanan
No. 3
Guest
ID EA Name
1 2 x
2 3 y
3 4 x
3 5 x
4 2 z
A. Code (SQL)
select tablename.*, tb1.sum_somefield from (
select max(id) mxid, sum(somefield) sum_somefield
from tablename group by Name
) tb1, tablename
where tablename.id=tb1.mxid