MS SQL Server 2005 ColdFusion 9.0.1 -----Original Message----- From: Greg Morphis [mailto:[email protected]] Sent: Wednesday, November 14, 2012 7:46 AM To: cf-talk Subject: Re: query: how to return records that are increments of one year old?
What DB are you using? On Wed, Nov 14, 2012 at 7:43 AM, Eric Bourland <[email protected]> wrote: > > Greetings. I need some advice again. I need to use CFSCHEDULE to > schedule a task that does the following: > > > > * review all records in table 'membersTable', once per day > > * return records that are one year (365 days) old, then two years old, > then three, and so on in increments of years > > * send a renewal reminder to the UserEmail associated with each found > record > > > > But I am having trouble building the query to return records that are > increments of one year old. How can I form this this query? > > > > The column "DateCreated" notes the date when a record was first created. > > > > <!--- query membersTable for records that are increments of one year > old > ---> > > <cfquery name="getUser" > datasource="#APPLICATION.dataSource#"> > > SELECT UserID, FirstName, LastName, > UserEmail, DateCreated > > FROM #REQUEST.membersTable# > > WHERE DateCreated = (DateCreated + > increments of one year) > > </cfquery> > > > > How should I form that WHERE clause? Thank you for any advice. > > > > Eric > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353157 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

