我有一张看起来像这样的表:
------------------------------------
| ID | Amount | Date |
------------------------------------
| 1 | 50.00 | 10/02/2010 |
| 2 | 20.00 | 10/02/2010 |
| 3 | 30.00 | 12/02/2010 |
| 4 | 70.00 | 12/02/2010 |
| 5 | 40.00 | 12/02/2010 |
------------------------------------
现在的问题是,如何创建一个查询,将按日期汇总金额并将其分组:
10/02/2010 70.00
12/02/2010 140.00
答案 0 :(得分:4)
SELECT [Date], SUM(Amount) TotalAmount
FROM YourTable
GROUP BY [Date]