SELECT *, (SELECT SUM(price) AS Money FROM ** where .......)FROM XXXX where username = ?"
聚合函数 sum 应配合 group by 使用
如
select id,sum(price) as Money from t_order where username=? group by id
除sum 以外 有几个 字段 就要 group by 几个字段
select id,username,sum(price) as Money from t_order where username=? group by id,username
另外 ?是字符 应该
username='..具体内容...'