初期テーブル:その列の3列目との和のことでグループの後特定のグループ
1 1 3
1 1 4
1 2 1
1 2 3
2 1 5
2 1 2
2 2 2
2 2 3
:
1 1 7
1 2 4
2 1 7
2 2 5
初期テーブル:その列の3列目との和のことでグループの後特定のグループ
1 1 3
1 1 4
1 2 1
1 2 3
2 1 5
2 1 2
2 2 2
2 2 3
:
1 1 7
1 2 4
2 1 7
2 2 5
SELECT Col1, Col2, SUM(Col3)
FROM dbo.YourTable
GROUP BY Col1, Col2
そのような何か ?
すべての列の値が同じである場合、それになるだけのグループでグループに複数の列を指定します。
SELECT ColA, ColB, Sum(ColC) as Summation
FROM YourTable
GROUP BY ColA, ColB
select one , two, sum(three) from ( select 1 as one, 1 as two, 3 as three from dual union select 1 as one, 1 as two, 4 as three from dual union select 1 as one, 2 as two, 1 as three from dual union select 1 as one, 2 as two, 3 as three from dual union select 2 as one, 1 as two, 5 as three from dual union select 2 as one, 1 as two, 2 as three from dual union select 2 as one, 2 as two, 2 as three from dual union select 2 as one, 2 as two, 3 as three from dual ) group by one, two;
はので、私の答えは間違っていたとは、rootを理解していませんでしたか?または、MS SQLとは異なる作業でグループ化しますか? –
no..itsはms sqlで正常に動作します。この答えに誰が投票したか分かりません。 –