Have your tried wrapping the val() function around the value when you add it to
the query? That way the column will be numeric when you do your sum(Total)
<cfscript>
myQuery = QueryNew("date,price,quantity");
newRow = QueryAddRow(MyQuery,2);
temp = QuerySetCell(myQuery, "date","05/01/2005",1);
temp = QuerySetCell(myQuery, "price",val(5.95),1);
temp = QuerySetCell(myQuery, "quantity",val(2),1);
temp = QuerySetCell(myQuery, "date","05/01/2005",2);
temp = QuerySetCell(myQuery, "price",val("null"),2);
temp = QuerySetCell(myQuery, "quantity",val(7),2);
</cfscript>
<cfdump var="#myQuery#">
<cfquery name="getSum" dbtype="query">
SELECT
sum(price) As TotalPrice,
sum(quantity) As TotalQuantity
FROM myQuery
WHERE date = '05/01/2005'
</cfquery>
<cfdump var="#getSum#">
>Hola peeps!
>
>Is there a way to tell the queryNew() function what datatype a
>particular column is?
>
>i have a query that i make that is the result set of a query or two,
>and i have a total column that i write a number to. the cells may be
>null, may have a number, but NOTHING else.
>
>select sum(Total)
>from getThis
>where date = '05/01/2005'
>
>and its telling me that it cant perform that operation where an
>operand is of type varchar. well its not. its numeric.
>
>any ideas?
>
>thanks
>
>--
>tony
>
>Tony Weeg
>
>macromedia certified coldfusion mx developer
>email: tonyweeg [at] gmail [dot] com
>blog: http://www.revolutionwebdesign.com/blog/
>cool tool: http://www.antiwrap.com
>
>"...straight cash homey"
>- randy moss, now a raider
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206150
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54