Greg, thank you very much. I will try this out and report my progress later
this evening.

Eric

-----Original Message-----
From: Greg Morphis [mailto:[email protected]] 
Sent: Wednesday, November 14, 2012 7:52 AM
To: cf-talk
Subject: Re: query: how to return records that are increments of one year
old?


cast(dateadd('y', -1, getdate()) as date) as  -- getdate() in MSSQL or
trunc(dateadd('y', -1, sysdate))  -- sysdate in Oracle




On Wed, Nov 14, 2012 at 7:46 AM, Greg Morphis <[email protected]> wrote:

> 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:353160
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to