Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Grouping alphabetically by first letter

New Here ,
May 29, 2008 May 29, 2008
I want to create a query that will group results based on the first letter of the record text. First they would be grouped by Category, then by letter of the alphabet and then be Ordered alphabetically. I would also like to use this query to try and populate a CFTREE.

As an example I would use Books.

The query would Order by: Book Category, the first letter of the Book Title, and finally the Book Title.

The results would be Grouped by: Book Category, then first letter of the Book Title.
257
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 30, 2008 May 30, 2008
Don't worry about the order by. Just order by the category then the book title. Select the first letter and use it for grouping in your cfoutput.
Translate
LEGEND ,
May 29, 2008 May 29, 2008
Does your db have a substring function?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 30, 2008 May 30, 2008
Hi Dan,

I am using mySQL and it does have a substring function. It is easy enough retrieve the first letter of a title but I am confused how to go about writing the query to be able to ORDER BY that letter.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 30, 2008 May 30, 2008
LATEST
Don't worry about the order by. Just order by the category then the book title. Select the first letter and use it for grouping in your cfoutput.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources