怎么对一个嵌套查询的结果求和

怎么对下面的语句的money进行sum求和
select money from details where id in (select id from goods where name = ‘%自行车%’)
子查询结果是个集合

select sum(money) from details where id in (select id from goods where name ='%自行车%')

有帮助的话,请点采纳该答案~

你这个是要模糊匹配自行车嘛,是的话需要改成


select sum(money) from details where id in (select id from goods where name like  '%自行车%')

直接sum就行了呀

select sum(money) from details where id in (select id from goods where name like ‘%自行车%’)