标签: mysql
如何从数据库中选择工资总额等于某个金额的用户..
"select * from users where sum(salary)=10000";
4个用户的工资总和可以带来10000个。
答案 0 :(得分:0)
SELECT O. *,(SELECT sum(salary)FROM users WHERE Id = O.Id)'RunningTotal'FROM users O WHERE RunningTotal = 10000