- select Agentname,cast(Sum(Amount) as int) as Tolling
- from Maintable where datepart(mm,date) =month(getdate())
- and datepart(yyyy,date) =year(getdate())
- group by Agentname order by Tolling desc";
This code snippet is for to get current Month Data from a table in sql server.
