>Personnally I think the time honored SQL solution is the best.
>
>You can have a navigation as follows:  ALL | A | B | C | D | ... | X | Y | Z

[etc...]

Nicely put solution. But I interpreted your intention, Robert, as wanting to place all 
listings on one page and having anchor links such as <a href="#A">A</a> | <a 
href="#B">B</a>. If so, take a look:

*The following SQL works on MS SQL Server 2000. If you're on a different db server and 
the upper() and substring() functions don't work, your db server will definitely have 
equivalents.*

Here's your query to get the book info. You also generate a custom column that 
contains the first letter of each title. Then you just order by that title.

SELECT title, otherFields, upper( substring(title,1,1) ) AS firstLetter
FROM tables
ORDER BY firstLetter, title

Then you can do this for the nav links:

<cfoutput query="name_of_query" group="firstLetter">
   <cfif CurrentRow NEQ 1> | </cfif>
   <a href="###firstLetter#">#firstLetter#</a> 
</cfoutput>

And you can do this for the actual book data:

<cfoutput query="name_of_query" group="firstLetter">
   <a id="#firstLetter#"></a>
   <cfoutput>
      <p>title: #title#<br>
      other field: <br>
      etc</p>
   </cfoutput>
</cfoutput>

This grouped cfoutput will output one <a id=... bookmark before the first book of each 
letter. Then the inner cfoutput displays all the actual books with that first letter. 
I'd refer to some passages in reference books that explain the "group" attribute of 
<cfoutput> but I don't have any books handy...sorry.

Mike Mertsock
Alfred University Web Team
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to