MS SQL Server 2012
Hi. I'm trying to build a query that requests news items that are fewer than ninety days old.
I started with this:
<cfset CurrentDate = now()>
<cfquery name="getNews" datasource="#application.datasource#">
SELECT newsID, newsTitle, newsExcerpt, newsAuthor, NewsDate
WHERE NewsDate GT CurrentDate <cfqueryparam cfsqltype="cf_sql_integer" value="-90">
ORDER BY NewsDate DESC
... but that gets me an error, and obviously I need help with the WHERE clause.
I also tried:
WHERE DATEDIFF(DAY, GETDATE(), NewsDate) > 90
But this returns No Records!
I've been researching this some ... but figured someone here knows the answer. How would you do this?
Also should I use cfqueryparam, above? =)
Thank you for any advice.