I have a small question about SQL Server: how to get the last 30 days of information from this table
Sample data:
Product :
Pdate ---------- 2014-11-20 2014-12-12 2014-11-10 2014-12-13 2014-10-12 2014-11-15 2014-11-14 2014-11-16 2015-01-18
Based on the data in this table, I want the output as shown below
pdate ------- 2014-11-20 2014-12-12 2014-12-13 2014-11-16
I tried this request
SELECT * FROM product WHERE pdate >= DATEADD(day, -30, getdate()).
but now he gives exactly the result. Please tell me how to solve this problem in SQL Server.
sql-server sql-server-2008 sql-server-2012 sql-server-2008-r2
user3457912
source share