Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
JigsFusion #1
Using aggregrate function sum() from within Cached Query
Hi, I have a query which returns say total 30 records. Now, form within these
30 records, I am using another Cached query which will retrive specific records
form the recordset of previous query. The code is show below :
<cfquery name ="myquery1" dbtype="QUERY">
Select sum(subtotal) from myquery
</cfquery>
subtotal field is of type varchar in the table.
myquery is the name of query which is execured before the above query. Now
when I execute query myquery1, it returns SUM function can not be used on
operand of type Varchar. But, I am able to use Max() or Min() function, still I
am unable to use SUM() function in executing cached query. It returns the
following error :
Query Of Queries syntax error.
Encountered "(" at line 2, column 27. Incorrect Select Statement, Expecting a
'FROM', but encountered '(' instead, A select statement should have a 'FROM'
construct.
Can any Please help me to sort out the problem.
JigsFusion Guest
-
Cached page and query results, help!
I have a frameset and on one frame I have a CFGrid. When I click on an entry in the grid, that same frame replaces itself with the record detail.... -
Cached query
I have got this query <CFQUERY NAME="GetImportData" DATASOURCE="ExcelNordic" USERNAME="#Application.SQLUserName#"... -
can you test for a cached query?
Is there something like IsDefined that tests for a cached query? If yes, I can use that to avoid going back to the DB. thanks in advance -brian -
how long is query cached without cachewithin tags?
Hi, I have a query that is used later in a "query of query". I was wondering how long the first query is cached if I don't add a cachewithin tag?... -
expired cached query
:rose; How can I catch the error produced when a user tries to refresh a page that depends on a cached query to display content, once the query has... -
Defuse #2
Re: Using aggregrate function sum() from within CachedQuery
When you use an aggregate function in SQL, you have to set it AS something. For instance:
SELECT SUM(field) AS totalField FROM mytable
HTH
Defuse Guest



Reply With Quote

