Thanks a zillion Nelson! Knew it had to be easy... just never used that before but it 
works Great!

At 08:00 PM 7/10/02, you wrote:
>Oops I forgot the "/" on the <cfoutput>:
>
>        <cfset Total = Total + InStock>
>    </cfoutput>
>
>----- Original Message -----
>From: "Nelson Winters" <[EMAIL PROTECTED]>
>To: "CF-Talk" <[EMAIL PROTECTED]>
>Sent: Wednesday, July 10, 2002 10:56 PM
>Subject: Re: SQL question...
>
>
>> Here's one way to do it using the group parameter of cfoutput.
>>
>> <cfoutput query="thelist" group="parttype">
>>     <!--- loop for every change in ParType --->
>>     <cfset Total = 0>
>>     <cfoutput>
>>     <!--- loop for every record --->
>>         <tr>
>>                 <td>#PartType#</td>
>>                 <td>#PartName#</td>
>>                 <td>#InStock#</td>
>>         </tr>
>>         <cfset Total = Total + InStock>
>>     <cfoutput>
>>      <tr>
>>              <td >SubTotal:</td>
>>              <td></td>
>>              <td>#Total#</td>
>>      </tr>
>> </cfoutput>
>>
>>
>> ----- Original Message -----
>> From: "Brian Scandale" <[EMAIL PROTECTED]>
>> To: "CF-Talk" <[EMAIL PROTECTED]>
>> Sent: Wednesday, July 10, 2002 10:34 PM
>> Subject: SQL question...
>>
>>
>> > I now this is quite simple... however I need clues to get me started...
>> > How does one go about breaking out the various subtotals from a dataset?
>> >
>> > Example:
>> > In this example table there are multiples of the same parttype.
>> >
>> > parttype  partname    instock
>> > --------  --------    -------
>> > carparts  mufflerX     25
>> > carparts  mufflerY     15
>> > carparts  engineSA     12
>> > carparts  wheel12      27
>> > planeparts  wingZ      9
>> > planeparts  rudderQ    3
>> > planeparts  engineRR   2
>> >
>> > Would typically do something like this in CF
>> > <query="thelist">
>> >   Select *
>> >   From parts
>> >   Order by parttype
>> > </query>
>> >
>> > <cfoutput query="thelist">
>> >    <tr><td>#thelist.PartType#</td><td>#thelist.PartName#</td></tr>
>> > </cfoutput>
>> >
>> > Would like to be able to generate subtotals...like this:
>> >
>> > parttype  partname  instock
>> > --------  --------  -------
>> > carparts  mufflerX   25
>> > carparts  mufflerY   15
>> > carparts  engineSA   12
>> > carparts  wheel12    27
>> > SUBTOTAL ---------   -----
>> >                      79
>> >
>> > planeparts  wingZ     9
>> > planeparts  rudderQ   3
>> > planeparts  engineRR  2
>> > SUBTOTAL -----------  ------
>> >                       14
>> >
>> > Thanks for any and all hints. ;-)
>> > Brian
>> >
>> >
>> 
>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to