I’m trying to select for all items where the createDt is in the last two weeks. I’ve tried this code but it doesn’t work.
SELECT * FROM dbo.mytable
WHERE CreateDt > dateadd(d,-15,CreateDt)
Can someone tell me the correct way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
should be
Presumably.
All
NOT NULLvalues ofCreateDtwill meet your current condition as you are comparing the column with its own value minus 15 days – not 15 days previous to the current date and time.