<cfquery name=date_list>
select * from table order by date
</cfq>

answers=structnew()

<cfloop query=date_list>
        month=mid(3,2,date)
        if StructKeyExists("#month#",answers)
                answers."#month#".sales=+#totalsales#
                answers."#month#".orders=+#totalorders#
        else
                answers."#month#"=structnew()
                answers."#month#".sales=+#totalsales#....
                answers."#month#".orders=+#totalorders#
        fi
</cfl>

then just cfloop over the keys of answers and print the values of the two
keys...

(Yes, slow day at work today ;-) )
-----Original Message-----
From: Shally [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 4:24 PM
To: CF-Talk
Subject: Creating report on monthly bases


Hi,
I have 3 Fields in my Access database table.
They are:
1)Date
2)TotalSales
3)TotalOrders
This table is updated on daily bases.
Example:
Date       TotalSales       TotalOrders
03/01/01   $11116.68            38  
 
03/02/01   $12596.11            24 

03/03/01   $3889.80             12
 
02/01/01   $2503.65              9  
 
02/02/01   $7409.24             36 
 
02/03/01   $14302.47            42  
 
02/04/01   $12985.15            33  
 

>From this table I have to add the total sales and the
total orders on monthly bases and then display it.
Like:
Date       TotalSales       TotalOrders
03/2001    $27602.05            74  
 
02/2001    $37200.04            120 

01/2001 and so on...
Please tell me where should I start.

Thanks in advance
Shally
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to