Reputation: 1430
I have to get records from a Query using Query of Queries in my F/W1 application. Im running it in coldfusion 10. My Query is as follows,
<cfquery name="qryFormData" dbtype="Query">
Select * from qryFormfields where language = 'ENG'
</cfquery>
And I'm getting this error
ERROR!
An error occurred!
Action: locations.default
Error: Error Executing Database Query.
Type: Database
Details:
Query Of Queries syntax error.
Encountered "language. Incorrect conditional expression, Expected one of [like|null|between|in|comparison] condition,
What I'm doing wrong? Any Help would be appreciated.
My Query is so simple as follows
<cfquery name="qryFormfields" datasource="#variables.dsn#">
SELECT cf.CustomFieldID, cfl.label,cfl.language,cf.Type FROM CustomFields cf
INNER JOIN CustomFieldLabels cfl ON cfl.CustomFieldID = cf.CustomFieldID
AND Entity = <cfqueryparam value="#arguments.tablename#" cfsqltype="cf_sql_varchar">
WHERE Language = <cfqueryparam value="#SupportedLangID.prefix#" cfsqltype="cf_sql_varchar">
AND SiteID = <cfqueryparam value="#arguments.SiteID#" cfsqltype="cf_sql_varchar">
</cfquery>
Upvotes: 3
Views: 4398
Reputation: 29870
LANGUAGE
is a reserved word in query on query. See the docs here: Query of Queries user guide: Escaping reserved keywords.
So you'll need to alias that column in your original query (or escape it with square brackets, as per the docs).
Upvotes: 8