Declare @StartDate date= '03/01/2015' Declare @EndDate date= '06/05/2015' select year(dt) [Year], month(dt) [Month], count(*) Days from ( select top (datediff(d, @StartDate, @EndDate)) dateadd(d, row_number() over (order by (select null)), @StartDate) dt from sys.columns ) q group by year(dt), month(dt) order by [Year], [Month]
Because sharing knowledge is good. (MSBI, SQL SERVER, Python, Pyspark, Azure Data Factory, Databricks, Machine Learning & Cloud Services)
Find List of Year, Month,Days On The Basis Of Month Between Two Dates
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment