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!

Alphabetic list 1

Status
Not open for further replies.

joakimhan

Technical User
Jul 9, 2001
12
0
0
SE
I got a problem that i hope someone can please help me with.
I got a database with names and url and languageid that i want to make to an alphabetic list

<CFQUERY NAME=&quot;getDomain&quot; DataSource=&quot;mysource&quot;>
SELECT name, url, langid
FROM domain
</cfquery>

I want to order my list as an alphabetic list something like this

A
ABCnews abcnews.go.com
AdWeek Advertising Age
Back to top

B
BBC News news.bbc.co.uk
Bloomberg Brandweek

etc

I can make it as an alphabetic list but how do I make it with the heading for every Character in the alphabet.

Hope someone can help me

Best Regards
Joakim Han
 
A little GROUPing should help.

<CFQUERY NAME=&quot;getDomain&quot; DataSource=&quot;mysource&quot;>
SELECT
name,
url,
langid,
Right(name,1) AS FirstChar
FROM domain
GROUP BY
FirstChar
</cfquery>

<cfoutput query=&quot;&quot; group=&quot;&quot;>
#FirstChar#
<cfoutput>
#name# #Url#
</cfoutput>
</cfoutput>
 
Need coffee and an edit button :)

<CFQUERY NAME=&quot;getDomain&quot; DataSource=&quot;mysource&quot;>
SELECT
name,
url,
langid,
Left(name,1) AS FirstChar
FROM domain
GROUP BY
FirstChar
</cfquery>

<cfoutput query=&quot;getDomain&quot; group=&quot;FirstChar&quot;>
#FirstChar#
<cfoutput>
#name# #Url#
</cfoutput>
</cfoutput>
 
Thank you very much.
I appreciate the help.

Joakim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top