Link to home
Start Free TrialLog in
Avatar of Becky Edwards
Becky EdwardsFlag for United States of America

asked on

T-Sql DATE Question

I need a filter that gives me all transactions posted prior to the first day of the current month.
I am going to place this in the record selection of a Crystal 2008 Report.
How can I say that in Sequel?

The field is a DATE field.  

Date({CLARITY_TDL_AGE.POST_DATE}) < First day of current month
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

CLARITY_TDL_AGE.POST_DATE < SELECT DATEADD(DAY, 1 - DAY(GETDATE()), DATEDIFF(DAY, 0, GETDATE()))
Avatar of Becky Edwards

ASKER

Nope, sorry.  It keeps saying the ) is missing where the word GETDATE is.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>The code acperkins provided is for use in SQL Server.<<
Exactly, I thought that is what they meant by "How can I say that in Sequel?"
Although on second thoughts it should have been:
CLARITY_TDL_AGE.POST_DATE < DATEADD(DAY, 1 - DAY(GETDATE()), DATEDIFF(DAY, 0, GETDATE()))
Avatar of James0628
James0628

Just another option for CR:

Date ({CLARITY_TDL_AGE.POST_DATE}) < Date (Year (CurrentDate), Month (CurrentDate), 1)


 James
Thanks everyone for your help!.  Sorry I wasn't clear on needing Crystal syntax.  The first one mimcc provided worked perfectly, so I haven't tried the others but I will keep all in reserve.

You are all awesome.  You make me look so good!