At 03:27 PM 8/12/2003 -0500, you wrote:
>How can I easily nab the SUM of the inventory.service_shipping records
>returned in this query via SQL? SUM blah AS cblah tosses an error, I
>suppose because just one part is aggregate? Any quick ideas?
Have you tried SUM(blah) AS cblah? Sometimes odd little syntax errors have
driven me crazy for hours on end because they have worked differently
before...Just a thought. One other option(albeit not as efficient) is to
set a variable and loop through the query...I.E.
<cfquery name="get_productHOLDS" datasource="sddheinz">
SELECT
customer_orders_prod_shiphold.product_id,
customer_orders_prod_shiphold.qty,
customer_orders_prod_shiphold.line_total,
customer_orders_prod_shiphold.order_id,
inventory.service_name,
inventory.service_shipping,
inventory.service_desc
FROM customer_orders_prod_shiphold
LEFT OUTER JOIN inventory on
customer_orders_prod_shiphold.product_id = inventory.service_id
WHERE customer_orders_prod_shiphold.order_id =
<cfqueryparam cfsqltype="cf_sql_integer" value="#order_id#">
</cfquery>
<cfset sum = 0>
<cfloop query="get_productHOLDS">
<cfset sum = sum + service_shipping>
</cfloop>
Good luck!
Andrew Golden
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics.
http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4