Mark,

I think the problem is the "date" column. Date is a reserved word, I
think, and must be wrapped in []. Also, I would use a query param as it
takes care of the data type conversion.

<cfquery name="search" dbtype="query">
   SELECT *
   FROM event
   WHERE [date] > <cfqueryparam value="#DateFormat(Now(),"mm/dd/yyyy")#"
cfsqltype="CF_SQL_TIMESTAMP" />
</cfquery>


......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-----Original Message-----
From: Mark Lewis [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 7:43 AM
To: CF-Talk
Subject: Query of Queries date comparison

Hi,

Wondered if someone could advise on this problem I am having.

I have created a query as shown below...


<cfset event = QueryNew("date, name, destination", "date, varchar,
varchar")>

<cfset newRow = QueryAddRow(event, 2)>

<cfset temp = QuerySetCell(event, "date", 07/28/2007, 1)> <cfset temp =
QuerySetCell(event, "name", "trip to zoo", 1)> <cfset temp =
QuerySetCell(event, "destination", "london", 1)>

<cfset temp = QuerySetCell(event, "date", 07/31/2007, 2)> <cfset temp =
QuerySetCell(event, "name", "trip to zoo", 2)> <cfset temp =
QuerySetCell(event, "destination", "london", 2)>


I would like to run a query on this query where it finds only the
records where the date is greater than today.

I have written the following...

  <cfquery name="search" dbtype="query">
   SELECT *
   FROM event
   WHERE date > #DateFormat(Now(),"mm/dd/yyyy")#
  </cfquery>

However I get an error returned 

"Query Of Queries syntax error.
Encountered "date. Incorrect conditional expression, Expected one of
[like|null|between|in|comparison] condition, "

Does this mean I cannot use this greater than ( > ) clause on a query of
queries, I have searched for some documentation but couldnt find any. I
f anyone knows where any could be posted on the web, or a solution to
this problem that would be great.

Thank you in advance

Mark

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284790
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to