Developer technologies | Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello All,
I have a table like below.
I need to get daily,weekly and monthly calls data from this.
Could any one please help what is the query to write here
Use a date function like YEAR, MONTH, DATEPART and an aggregation, like
select YEAR(date) AS Year, MONTH(date) AS Month, SUM(Calls) AS Calls
from yourTable
group by YEAR(date), MONTH(date)
order by YEAR(date), MONTH(date)
for a monthly report.
See https://learn.microsoft.com/en-us/sql/t-sql/functions/date-and-time-data-types-and-functions-transact-sql?view=sql-server-ver15#DateandTimeFunctions
for details.