Reputation: 307
Query I'm grouping from looks like this..
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|
Trying to create the grouped query...
FirstName|LastName|Description|Sum of Payment Types
Stone |Striclan|FICA |-4001.56
Stone |Striclan|Cost of Lab|20000.78
Where the query is grouped by description and with the sum of the checkAmt's of description. I can't seem to figure out how to go about creating the Sum of Payment Types part, any and all help is much appreciated.
Upvotes: 0
Views: 47
Reputation: 89285
You can try this way :
SELECT FirstName, LastName, Description, SUM(CheckAmt) As 'Sum of Payment Types'
FROM MyTable
GROUP BY FirstName, LastName, Description
Upvotes: 2