查询我是从这样看起来分组..
FirstName|LastName|SSN|CheckNo|CheckDate|CheckAmt|Description|
Stone |Striclan|271-1397543|131292223|-2000.78|FICA |
Stone |Striclan|271-1397543|131292223|-2000.78|FICA |
Stone |Striclan|271-1397543|131292223|20000.78|Cost of Lab|
尝试创建分组查询...
FirstName|LastName|Description|Sum of Payment Types
Stone |Striclan|FICA |-4001.56
Stone |Striclan|Cost of Lab|20000.78
查询按描述进行分组,并使用checkAmt描述的总和。我似乎无法弄清楚如何创建付款类型总和部分,非常感谢任何和所有帮助。
答案 0 :(得分:2)
您可以尝试这种方式:
SELECT FirstName, LastName, Description, SUM(CheckAmt) As 'Sum of Payment Types'
FROM MyTable
GROUP BY FirstName, LastName, Description