Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

It must be my cfoutput...

Status
Not open for further replies.

programmher

Programmer
Joined
May 25, 2000
Messages
235
Location
US
I have a simple query:

<cfquery name=&quot;Tabulate&quot;>
Select Guest, Charge, Amount, Date
From InnTable
Where guest = 'jones'

</cfquery>

My result looks something like this:

Jones Cable TV 25.00 08/01/01
Jones Phone .75 08/03/01
Jones Phone .75 08/10 01

I want my result to look like this:

Jones 26.50

When I run this in query analyzer and either use a SUM or Order BY, I get my desired result.

But, when I run this from my webpage, I am unable to get my fields to sum.

I suspect something is amiss with my cfoutput. I used <cfoutput query=&quot;Tabulate&quot; group=&quot;Guest&quot;> Then I attempt to group by &quot;Charge&quot; but to no avail.

What am I missing?
 
try this:


<cfquery name=&quot;Tabulate&quot;>
Select Guest, Charge, SUM(Amount) as total, Date
From InnTable
Where guest = 'jones'

</cfquery>


<cfoutput query=&quot;Tabulate&quot;>
#guest# #total#
</output> Sylvano
dsylvano@hotmail.com

&quot;every and each day when I learn something new is a small victory...&quot;
 
Sylvano,

Thanks a million! That worked like a charm. I actually did this before but couldn't remember exactly how I did it.

Thanks for the help!

-P
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top