0

Hi ok I have a table: "rlbTerms" that contains basically a list of terms and their definitions.
I create a page with a query that returns all the terms and definitions in a table layout and are order by terms ASC.

What I want is a way to create anchor tags dynamically so that a user can click on the letter "G" and it will take them to the "G" section of the table.

I tried googling the function, but honestly not sure what to look for. I hope I explained this well enough to understand. Thanks for any advice in advance!

btw here is my query:

<cfquery name="rsTerms" datasource="rlbulbs">
SELECT rlbterms.terms, rlbterms.definitions
FROM rlbterms
ORDER BY rlbterms.terms
</cfquery>

Here was what I was trying to do:

<cfquery name="rsTerms" datasource="rlbulbs">
SELECT rlbterms.terms, rlbterms.definitions, left(rlbterms.terms,1) AS letterField
FROM rlbterms
ORDER BY rlbterms.terms
</cfquery>
2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by teedoff
0

I think this is really more of a cold fusion question than sql (and I haven't used cold fusion in over ten years so I can't answer). Usually you would do this on the scripting layer rather than the Db layer.

As you loop through the results you build a string of the first letters as you build the output, adding in the anchors as you go. Then you output the letter based index string first followed by the full detailed results string.

0

Hi Brillig thanks for the reply. No actually it is a SQL question. The LEFT() function is a SQL string function. Anyway, I almost have it working! lol

The issue I am having now is probably more a CF issue. Not sure whether to mark this solved yet or not though

Thanks again!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.