mysql总和,带有行ID

2022-01-09 00:00:00 sum mysql

在 MySQL 中,我试图总结一列但保留行 ID.当我进行求和时,ID 被压缩,结果是

In MySQL I'm trying to sum up a column but retain the row IDs. When I do a sum, the IDs are compressed and the result is

1 |1500

我想要的是

1,2,3 |1500

1,2,3 | 1500

推荐答案

SELECT GROUP_CONCAT(id), SUM(value) FROM table

相关文章