我在 SQL 中有这样的产品表:
productID Type Amount
1046 1 4
1046 1 5
1046 2 10
1047 1 5
1047 2 3
Run Code Online (Sandbox Code Playgroud)
如何进行查询,输出如下:
productID Type TotalTypeAmount TotalPerProductID
1046 1 9 19
1046 2 10 19
1047 1 5 8
1047 2 3 8
Run Code Online (Sandbox Code Playgroud)