Answered
Query Of Queries syntax error.
Hi all,
I have the following query:
<cfquery name="agent" datasource="datasourcename">
SELECT * FROM quotes where status = 'Pending'
<cfif isDefined("form.agent")>
AND agent = '#FORM.agent#'
</cfif>
</cfquery>
Then, I have the following query of that query
<cfquery name="totalvalue" dbtype="query">
SELECT SUM(value) as total FROM agent
</cfquery>
however I get the following error:
Query Of Queries syntax error.
Encountered "SUM ( value. Incorrect Select List,
on line 20 which is:
<cfquery name="totalvalue" dbtype="query">
now i'm sure this is identical to what ive used before but getting the error. the totals query works fine when querying the database direct, only got this error when I changed it to query the master query.
i appreciate any help in advance, as no matter how much i stare at it I can't see whats wrong!
I have the following query:
<cfquery name="agent" datasource="datasourcename">
SELECT * FROM quotes where status = 'Pending'
<cfif isDefined("form.agent")>
AND agent = '#FORM.agent#'
</cfif>
</cfquery>
Then, I have the following query of that query
<cfquery name="totalvalue" dbtype="query">
SELECT SUM(value) as total FROM agent
</cfquery>
however I get the following error:
Query Of Queries syntax error.
Encountered "SUM ( value. Incorrect Select List,
on line 20 which is:
<cfquery name="totalvalue" dbtype="query">
now i'm sure this is identical to what ive used before but getting the error. the totals query works fine when querying the database direct, only got this error when I changed it to query the master query.
i appreciate any help in advance, as no matter how much i stare at it I can't see whats wrong!
