Paul you need something along the lines of:

<cfquery name="get_AZ" datasource="#request.dsn#">
        SELECT DISTINCT LEFT(schoolName,1) AS alpha
        FROM table
</cfquery>

...then loop the result set with:

<cfloop query="get_AZ">
        <cfoutput><a name="#alpha#">#alpha#</a></cfoutput>
        <cfquery name="get_AZ" datasource="#request.dsn#">
                SELECT * FROM TABLE
                WHERE LIKE '#URL.ALPHA#%'
        </cfquery>
</cfloop>

...with  the wildcard character after the variable -- this basically
says anything beginning with the letter whatever

HTH

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: 02 February 2004 15:51
To: [EMAIL PROTECTED]
Subject: [ cf-dev ] Another interesting problem ...


<cfquery name="select_az" datasource="schoolsBudget">
      SELECT DISTINCT LEFT(schoolName,1) AS schoolFirstLetter
      FROM "table$"
      ORDER BY LEFT(schoolName,1)
</cfquery>

<cfoutput query="select_az">
<a href="###schoolFirstLetter#">#schoolFirstLetter#</a>
</cfoutput>
<p></p>


The above code is  an a-z which fetches the first letter of each entry
in
column (schoolName)
When the user selects A (forinstnace) I want to jump to A on the same
page
ok no problem done that now ##
At the A (anchor) I want to display all the A Schools then B schools etc
and so on.

So.....

<some list,array,??? to loop around>
<cfquery name="select_az" datasource="schoolsBudget">
      SELECT schoolName,dfesNo
      FROM "table$"
      WHERE       (LEFT(schoolName,1) = <the looping variable>)
      ORDER BY SchoolName
</cfquery>
</list.array,loop>

Can I do the above? How can I populate the list / array with the first
letter?

Regards - Paul






************************************************************************
*************************
The information contained within this e-mail (and any attachment) sent
by Birmingham City Council is confidential and may be legally
privileged. It is intended only for the named recipient or entity to
whom it is addressed. If you are not the intended recipient please
accept our apologies and notify the sender immediately, or telephone
+(44) 121 303 6666. Unauthorised access, use, disclosure, storage or
copying is not permitted and may be unlawful. Any e-mail including its
content may be monitored and used by Birmingham City Council for reasons
of security and for monitoring internal compliance with the office
policy on staff use. E-mail blocking software may also be used. Any
views or opinions presented are solely those of the originator and do
not necessarily represent those of Birmingham City Council. We cannot
guarantee that this message or any attachment is virus free or has not
been intercepted and amended.

************************************************************************
*************************


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to