Try this query (given earlier) and this code for your output:

<cfquery name="info" datasource="yourdb">
SELECT *
FROM Customers
ORDER BY LastName DESC
</cfquery>

<cfset fletter = "">
<Table>
<cfoutput query="info">         
        <cfif fletter neq Left(Lastname, 1)>
                <cfset fletter = Left(Lastname, 1)>
                <tr>
                        <td>#fletter#</td>
                </tr>
        </cfif>
        <tr>
                <td>
                        #lastname# , #FirstName#
                </td>
        </tr>
</cfoutput>
</table>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 12:53 PM
To: CF-Talk
Subject: RE: <cfoutput> lists Alphabetically


This would be an order by statement in your SQL call...

like so...


<cfquery name="info" datasource="yourdb">
SELECT *
FROM Customers
ORDER BY LastName DESC
</cfquery>

use that ORDER BY statement as a DESC - descending, or ASC ascending...

hth

kevin

~~~~~~~~~~~~~~~~~
Kevin Mansel
Web Developer
Fox Communications
[EMAIL PROTECTED]
DL : 425-649-1321
C : 425-346-7221



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