query of queries problem

I am trying to create a coldfusion query of queries but the dates

does not seems to be working. I am getting the error message
Query Of Queries syntax error.
Encountered "DATEDIFF ( d ,. Incorrect conditional expression, Expected one of [like|null|between|in|comparison] condition,

Select * from myQuery where 0=0 and DATEDIFF(d, '11/22/2012', '12/07/2011') <= 0

LVL 19
erikTsomikSystem Architect, CF programmer Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gdemariaCommented:
DateDiff is probably not available in QofQ as it's a database specific function

Try putting the dateDiff inside your main SELECT statement to show the number of days difference

 select dateDiff(d,createdDate,getDate())  as NumberDays

then in your QofQ you can just check the number of days column...

 where numberOfDays <= 0

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
erikTsomikSystem Architect, CF programmer Author Commented:
I am trying to run
Select *,( (param 1) ) AS target_date,dateDiff(d,11/22/2012,getDate()) as num from myQuery.

And I get an error message
Query Of Queries syntax error.
Encountered "(. Incorrect Select Statement, Expecting a 'FROM', but encountered '(' instead, A select statement should have a 'FROM' construct.
0
_agx_Commented:
(no points)

> And I get an error message

Right. Like gdmaria said, you can't use DateDiff in a QoQ.  It's not a supported.

If you need to use dateDiff, you'll have to move it into your main databasequery instead.
0
gdemariaCommented:

Move this

   ,dateDiff(d,11/22/2012,getDate()) as num

Into your "MyQuery" 's select statement, don't do it in the query-of-query...


Actually, you don't need the database at all for this... it's a static state and current date.  Just do a cfset..

 <cfset days = dateDiff("d", "11/22/2012",  now())>

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.