My content table looks like (contentID
, title
, created
). I need to get all content that was created more than 3 weeks ago.
Using a SQL Server database and created
is of datetime
datatype.
How about:
select contentID, title, created
from content
where created < dateadd(week,-3,getdate());
This sticks closer to the question. 21 days is fine, obviously means the same, but I find that it's good to use the terminology used in the question.
For example... a while back I was asked to survey an average of 1 in 50 visitors to a site. I described this as a proportion of 0.02, and the client wasn't happy. I pointed out to the client that they're the same, but I learned my lesson, and now if I change the way that something is described, I make sure I comment to that effect, and preferably don't change it in the first place. If the client wants 3 weeks, do it as 3 weeks, not 21 days.
in MS SQl 2000/2005 you can do this
Select
contactID,
title,
created
from
content
where
created < getdate()-21
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With