Query Of Queries syntax error. Encountered “DELETE.
If you want to delete some rows from a Query of Query with the DELETE statement you will most likely have encountered the error: Query Of Queries syntax error. Encountered “DELETE.
You can’t use the DELETE statementin QoQ.
Try the following instead
<cfquery
dbtype=”query”
name=”rsDelete”>
SELECT expiryDateTime
, cacheHash
FROM variables.instance.cacheCollection
WHERE (expiryDateTime < <cfqueryparam value=”#now()#” cfsqltype=”CF_SQL_DATE”>)
</cfquery>
<cfloop query=”rsDelete”>
rsDelete.deleteRows( javaCast( “int”, (rsDelete.currentRow – 1) ), javaCast( “int”, 1 ) );
</cfloop>
You can only use SELECT statements in Query of Query commands. This is pretty clear in the documentation.
Conversly, because you can use SELECT statements, you can simply NOT select the rows/objects that you are trying to delete.
quetwo
May 25, 2009