Thursday, March 10, 2022

Sum function with Group By clause in SQL Server and without count with group by clause

SELECT SUM(Amount), AgentCode FROM Agent

GROUP BY AgentCode



Table structure(screenshot below)


---------------------------

without count in group by(use group by and select, same column)

SELECT Amount from Agent GROUP BY Amount


Reference:- https://www.w3resource.com/sql/aggregate-functions/sum-with-group-by.php



No comments:

Post a Comment