mysql 一列去重后另一列再进行求和

如:

idnameprice
1apple32
2apple32
3orger23
4orger23
5cole14
6cole14

如何写一个sql 查询出求和 32+23+14=69?
name列去重后,price列求和

用子查询。先distinct把name和price相同的数据查询出来,再求和。

select sum(price) from (select distinct name,price from #table group by name,price) x

DISTINCT