Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Month ahead SQL statement - Adobe Campaign

New Here ,
May 04, 2020 May 04, 2020

I am attempting to get a query that looks at an entire month ahead.

 

So for example.  We are sending out card expiry emails in this Month (May) but I want to query all those that have a subscription end date in June.

 

I have used:

on or after: AddMonths(ToDate( GetDate()) , 1)

AND before: AddMonths(ToDate( GetDate()) , 2)

 

But I think this will return June 4-July4.  All I want it June 1-June 30.  What is the correct SQ statement to use?

TOPICS
Database access
775
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2020 May 04, 2020
LATEST

Use ColdFusion to get the current month, then add one.  Get the last date of said month.  Pass them along to the query so that the SQL will be

 

WHERE date >= 01-{next month}-yyyy and date <= {last date}-{next month}-yyyy

 

HTH,

 

^ _ ^

 

UPDATE:  If you want to be more granular about it, and if the date includes the time:

WHERE date >= 01-{next month}-yyyy 00:00:00.0000 and date <= {last date}-{next month}-yyyy 23:59:59.9999

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources