MYSQL 如何将重复的行号与所有数据合并为一行
MYSQL how to combine duplicate rows numbers into one row with all data
如何将同一 table 中的重复行合并为一行 total affiche 例如,如果我有以下两行:
| doc | grp | used
h1 TC3 1.235
h1 TC3 3.501
h3 MR1 35
h4 BB1 135
h4 BB1 1.20
我希望这个 affiche 全部排成一行,不重复
| doc | grp | used
h1 TC3 4.736
h3 MR1 35
h4 BB1 136.20
select doc,
grp,
sum(used) as used
from table
group by 1,2 order by 1
如何将同一 table 中的重复行合并为一行 total affiche 例如,如果我有以下两行:
| doc | grp | used
h1 TC3 1.235
h1 TC3 3.501
h3 MR1 35
h4 BB1 135
h4 BB1 1.20
我希望这个 affiche 全部排成一行,不重复
| doc | grp | used
h1 TC3 4.736
h3 MR1 35
h4 BB1 136.20
select doc,
grp,
sum(used) as used
from table
group by 1,2 order by 1