?
Solved

sum from two CF queries

Posted on 2003-02-19
5
Medium Priority
?
227 Views
Last Modified: 2013-12-24
I have two queries as such:

<cfquery name="OrderGrab" datasource="eldb">
Select * from Orders, CustomerInfo, Templates, Budgets
where Orders.OrderID = #URL.recordID#
and Orders.CustomerID = CustomerInfo.CustomerID
and Templates.BudgetID = Budgets.BudgetID
and Templates.TemplateID = Orders.TemplateID
</cfquery>

and

<cfquery name="Addons" datasource="eldb">
SELECT *, (AvailableAddons.AddonPrice * OrderAddons.Quantity) as TOTAL
FROM dbo.AvailableAddons
inner join OrderAddons on OrderAddons.AddonID = AvailableAddons.AddonID
WHERE OrderAddons.Quantity >= 1
AND OrderAddons.OrderID = #URL.recordID#
</cfquery>

I want to sum the total of #Addons.TOTAL# and #OrderGrab.BudgetPrice# but don't know how to do it.

I'm brand spanking new to Coldfusion & SQL so hopefully this is an easy question.

Thanks!

0
Comment
Question by:tatortot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
HamdyHassan earned 200 total points
ID: 7983484


<CFSET sum_addons_total = 0.00 >

<cfoutput query="Addons">

......
......
<CFSET sum_addons_total = #sum_addons_total# + #TOTAL# >
</cfouput>

<cfoutput>
<BR> Sum of Addons Total is #sum_addons_total#
</cfoutput>

0
 

Author Comment

by:tatortot
ID: 7983746
Thanks, your answer got me in the right direction. What I ended up doing was:

<CFSET sum_addons_total = 0.00 >
<CFSET sum_all_total = #OrderGrab.BudgetPrice# >

---------
---------

<cfoutput query="Addons">
<CFSET sum_addons_total = #sum_addons_total# + #TOTAL# >
</cfoutput>
<cfoutput>
<BR> Sum of Addons Total is #sum_addons_total#
</cfoutput>

<cfoutput query="OrderGrab">
<CFSET sum_all_total = #sum_all_total# + #sum_addons_total# >
</cfoutput>

<cfoutput>
<BR> Complete Total is #sum_all_total#
</cfoutput>

Thanks again, Hamdy!! Now I need to figure out how to give you the points (this is my first post).

0
 
LVL 9

Expert Comment

by:HamdyHassan
ID: 7983778
I am happy it's working for you

Good Luck


take a look on
http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

or click "help" at the top of your page
0
 

Author Comment

by:tatortot
ID: 7984171
Well, it seems as though I *should* receive an email so I can accept your answer??

Someone posted a message today stating that email notification was down. I will wait & make sure I get the points to you somehow! :)
0
 

Author Comment

by:tatortot
ID: 7984176
I'm blind... I just noticed: "Accept Comment As Answer" link. Doh!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question