SOLVED... I got it to give me a different error which led me to a 
posting on ExpertsExchange which mentions that "cast" is actually a 
valid function to use in query of queries.

http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001270.htm#1182700

this page describes the need to cast things when you use QueryNew() 
without specifying column types.  Of course, mine is actually a query 
result set, and so the datatype SHOULD be in the metadata.  So I dumped 
the following:  #getMetaData(contents)#

There it is!  the OPTION_PRICE column's datatype is seen by coldfusion 
as "Unknown" for some reason.  So apparently coldfusion treats it as a 
varchar.

That's either a coldfusion bug or a JDBC driver bug.  The MySQL data 
type is "DECIMAL(10,2)"

So I have to use CAST.

Here's the working query:

select
        sum(QUANTITY) AS QUANTITY,
        SUM(QUANTITY * CAST(OPTION_PRICE as decimal)) AS MERCH_CHARGE
FROM contents

Rocl

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240364
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to