You also avoid all the looped queries and conditional code by writing 1 SQL
query and grouping your cfoutput:

<CFQUERY NAME="directory" DATASOURCE="someds">
SELECT
        lastname,
        firstname,
        LEFT(lastname, 1) AS letterindex
FROM
        Directory_tbl
ORDER BY
        letterindex,
        lastname,
        firstname
</CFQUERY>

<CFOUTPUT QUERY="directory" GROUP="letterindex">
#directory.letterindex#<BR>
<CFOUTPUT>#directory.lastname#, #directory.firstname#<BR></CFOUTPUT>
</CFOUTPUT>

Ian MacFadyen
Sr. Application Developer
Cardinal Communications
http://www.cardinalweb.com
[EMAIL PROTECTED]
ph. 510.647.1400 x 210


-----Original Message-----
From: Christine Kelley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:28 AM
To: CF-Talk
Subject: <cfoutput> lists Alphabetically



Hi!
   How do I output a whole list of names from a query
grouped alphabetically?  Output example:

A
Allen, Bob
Ames, John

B
Book, Sam
Briant, Max

I'm thinking it's by somehow using the group attribute of
the <cfoutput> tag or looping through the query, but I'm
not sure exactly how to get these results.

Thank-you for any help!
   Christine


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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