How to retrieve last 6 months data in sql server

How to retrieve last n months data in sql server ?


Query :


  SELECT *
  FROM [db1].[dbo].[Data]
  where  entry_date >= dateadd(mm,datediff(mm,0,getdate())-6,0)


Parameter :  Pink color marked data object worked as n number of months .

Output :

Display last 6 months data from current date.



Comments

Popular posts from this blog

Add Serial no in crystal report without coding

Working with Oracle's BLOB and Microsoft's C#

File operations in C# (.net)