且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MS SQL中的聚合函数问题

更新时间:2023-02-01 09:49:00

您需要按名称分组,然后选择名称和金额总和.
顺便说一下,这很容易通过Google进行搜索:
^ ]
You need to group by name, and select on name and the sum of amount.
This is easily googleable by the way:
http://www.google.com/search?q=group+by+with+sum&sourceid=ie7&rls=com.microsoft:en-gb:IE-SearchBox&ie=&oe=[^]


家庭作业?
无论如何,答案就在这里:
Homework?
Any way, here goes the answer:
SELECT [Name],SUM(Amount) 
FROM tableA
Group By [Name]