Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
1.1k views
in SQL Server by 39 42 54
I am currently developing an MVC solution with an SQL Server database, and I need to retrieve the last modified rows in the last 30 days, how can I do this using SQL.

1 Answer

1 like 0 dislike
by 39 42 54
 
Best answer

Get Date after 30 Days in SQL

To obtain a date in the last 30 days using an SQL query, you can use the below query:

select  *  from [Table] where Cast([ModifiedDate] as date) = Cast(DATEADD(day,-30, getdate()) as date)
If you don’t ask, the answer is always NO!
...