-1
让我们说我有这样一个表 -MySQL的选择多列与和列
id | name | salary
01 | ABCD | 1000
02 | EFGH | 2000
03 | IJKL | 3000
现在是有可能得到的结果这样设置?
id | name | salary | SUM
01 | ABCD | 1000 | 6000
02 | EFGH | 2000
03 | IJKL | 3000
我试过SELECT id, name, salary, SUM(salary) FROM table
但它只是给了我一行。有没有办法让所有的行都有额外的列?
http://stackoverflow.com/questions/2563918/create-a-cumulative-sum-column-in-mysql的重复 –