Hi, Go through this...
Previous months last date
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))
Current months last date
SELECT DATEADD(S,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))
Difference for current month and previous month in month
Select DATEDIFF(M,DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)),DATEADD(S,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0)))
Or try this
Select MONTH(DATEADD(S,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0)))- MONTH(DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)))
Or use
Select datediff(Month,DATEADD(month,-1,getdate()) ,GETDATE() )