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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting by date

Status
Not open for further replies.

mx3com

Technical User
Oct 29, 2000
9
0
0
CA
I have an output page that list's transactions with there associated dates. I would like to split these items into sub sections sortng them by date (every 3 months)

Basically every quarter (4 per year) will be shown in a separate section of the table.

My code so far to output the data is as follows:

<CFQUERY DATASOURCE=&quot;mx3&quot; NAME=&quot;mx3&quot;>
SELECT *
FROM Donators
ORDER BY DonationDate, DonatorNumber
</CFQUERY>

<TABLE><TR>
<TD><B>Donator Name</B><BR></TD>
<TD><B>Donation Method</B><BR></TD>
<TD><B>Date Donated</B><BR></TD>
</TR><TR>
<TD><CFOUTPUT QUERY=&quot;mx3&quot;>#DonatorName#<BR></CFOUTPUT></TD>
<TD><CFOUTPUT QUERY=&quot;mx3&quot;>#DonationMethod#<BR></CFOUTPUT></TD>
<TD><CFOUTPUT QUERY=&quot;mx3&quot;>#DateFormat(DonationDate, 'MMMM D, YYYY')#<BR></CFOUTPUT></TD>
</TR></TABLE>

How do I specify subgroups of these transactions? In the table I have a field that specifies which quarter of the year they were made. (ie. 2002-1, 2002-2, 2002-3, 2002-4)

Thanks in advance for your help.

Jeff
 
Hey Jeff,

Read up on &quot;Group&quot; with <cfoutput>

the idea is that you can loop within a loop based on one field in the DB. You have to actually include that field in the Query as Order(ed) By. I think it will do what you want, it solved a lot of my problems like this anyway.

Have fun...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top