Try something like this...

<cfquery name="get_all_lastnames" datasource="#dsn#">
        SELECT  lastname
        FROM    tablename
        WHERE   userid = 1
        ORDER BY lastname
</cfquery>

<cfparam name="alphalist" default="">

<cfoutput query="get_all_lastnames">
        <cfif alphalist IS "">
                <cfset alphalist = Left(lastname, 1)>
        <cfelse>
                <cfset find = ListFind(alphalist, #Left(lastname, 1)#)>
                <cfif find IS 0>
                        <cfset alphalist = ListAppend(alphalist, #Left(lastname, 1)#)>
                </cfif>
        </cfif>
</cfoutput>

<cfoutput>
<cfloop list="#alphalist#" index="i">
        <a href="page.cfm?alpha=#i#">#i#</a>
</cfloop>
</cfoutput>

Good luck,
Nathan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 26, 2001 9:42 AM
To: CF-Talk
Subject: Re: Alphabetic List


Thanks for your replies.

I think I didn't elaborate the question clearly.

What I need is to output the list:

All - A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - Lists

If there are persons last names start with "B", B should be a hot link.
If there is no one's last name starts with "Q", Q is not clickable.

Thanks!

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